Conversation
supportI’m stuck! Would you help me? I need a PHP query: – If no subtitle is entered, the category name(s) should be displayed. Thanks in advance!
Hi iwd82, Please try following code and let me know is it work 😉 <?php if (function_exists('the_subtitle') ){ the_subtitle(); }else { ?> single_cat_title(); <?php }? ~Ben
Thanks for your reply Ben! Unfortunately, your suggestion does not work. I think it may not work, because the query is based on the activated function. After the plugin was enabled, no category will be displayed, because the subtitle is functionally exist. What do you think about this: <?php if($page_sub_title) { echo $page_sub_title = get_post_meta($post->ID, 'page_sub_title', true); } else { echo $category = the_category(', '); } ?> I guess that could work. Jonathan
Hi iwd82, Please try following code and let me know is it work 😉 <?php if (function_exists('the_subtitle') ){ the_subtitle(); }else { ?> single_cat_title(); <?php }? ~Ben
Thanks for your reply Ben! Unfortunately, your suggestion does not work. I think it may not work, because the query is based on the activated function. After the plugin was enabled, no category will be displayed, because the subtitle is functionally exist. What do you think about this: <?php if($page_sub_title) { echo $page_sub_title = get_post_meta($post->ID, 'page_sub_title', true); } else { echo $category = the_category(', '); } ?> I guess that could work. Jonathan