Trouble with If/Else using interwoven PHP calls
-
Can anyone help me understand how to do an if/else with interwoven PHP items starting and stopping?
I have a Page Title on a Page that is inserting the Category Title on top of the Page Title even though it’s a standard page not a post.
I’d like it to be:
If cat post this title tag and determine which cat title to post.
Else remove this tag from standard pages.The way it’s written works for detecting specific categories, however I wrote with lack of understanding on how to make it NOT show up on normal Pages.
Help much appreciated.
Here is what works for detecting cat page vs normal page.
//ADD CATEGORY TITLE AT TOP OF CAT PAGES add_action('pagelines_inside_top_postloop','cat_title'); function cat_title(){ if (is_category('news') || ('inspiration') ) { ?> <h1 class="cat-title"><?php single_cat_title(); ?></h1> <?php } }Here is where I’m trying to go with it.
add_action('pagelines_inside_top_postloop','cat_title'); function cat_title(){ if (is_category('news') || ('inspiration') ) { ?> <?php print "<h1 class='cat-title'> " ?> <?php single_cat_title(); ?> <?php "</h1>"; } else { ?> <?php print "<h1 class='cat-title' style='display: hide; visibility: hidden;'> " ?> <?php single_cat_title(); ?> <?php "</h1>"; } } ?>
The topic ‘Trouble with If/Else using interwoven PHP calls’ is closed to new replies.