Title: Need a PHP query! If no subtitle is entered, the category name(s) should be disp
Last modified: August 20, 2016

---

# Need a PHP query! If no subtitle is entered, the category name(s) should be disp

 *  [Jonathan](https://wordpress.org/support/users/iwd82/)
 * (@iwd82)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/need-a-php-query/)
 * I’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!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [HasanulBanna](https://wordpress.org/support/users/hasanulbanna/)
 * (@hasanulbanna)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/need-a-php-query/#post-3235462)
 * 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
 *  Thread Starter [Jonathan](https://wordpress.org/support/users/iwd82/)
 * (@iwd82)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/need-a-php-query/#post-3235463)
 * 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

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Need a PHP query! If no subtitle is entered, the category name(s) should
be disp’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/subtitle-360_96334b.svg)
 * [Subtitle 360](https://wordpress.org/plugins/subtitle-360/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/subtitle-360/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/subtitle-360/)
 * [Active Topics](https://wordpress.org/support/plugin/subtitle-360/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/subtitle-360/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/subtitle-360/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jonathan](https://wordpress.org/support/users/iwd82/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/need-a-php-query/#post-3235463)
 * Status: not resolved