• Hi there,

    Something I have been struggling with for a while as I am a novice. On every page I have an instruction to GET Page Title:

    <?php echo get_the_title( $ID ); ?>

    However as some of my pages are Categories when you are on this page it returns “Untitled”.

    What I would like to do is one piece of code which GET Page Title but if there’s no page title get category title instead else do nothing, output blank, “”.

    I know how to get category title:

    <?php single_cat_title(); ?>

    However I cannot combine the two to achieve what I need.

    Any help would be much appreciated.

    Cheers,

    James

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Page Title > If No Page Title > Get Category Title’ is closed to new replies.