Check if Event Category is Empty
-
I am trying to make a shortcode that checks if a Time.ly event category is empty. If it is, nothing happens. If it is not, the PHP will put in a <h2>title:
function editorspicks_func( $atts ) { $EditorsPicksCategory = get_category(162);/* 162 = Editor's Picks category under Events > Organize */ if(!empty($EditorsPicksCategory)) { $EditorsPicksCode='<h2>Editor’s Picks:</h2>'; }else{ $EditorsPicksCode='<h2>Empty:</h2>'; } return $EditorsPicksCode; } add_shortcode( 'editorspicksevents', 'editorspicks_func' );
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Check if Event Category is Empty’ is closed to new replies.