Get Page Title > If No Page Title > Get Category Title
-
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 “”.
I know how to get category title
<?php single_cat_title(); ?>
but I cannot combine the two to achieve what I need.Any help would be much appreciated.
Cheers,
James
- The topic ‘Get Page Title > If No Page Title > Get Category Title’ is closed to new replies.