if ( is_page() ) Showing on Every Page or Not Showing at All
-
I’ve added the below code to my functions file and it’s working fine.
add_action( 'genesis_before_content_sidebar_wrap', 'bw_category_header' ); function bw_category_header() { if( is_category() ) echo '<h1 class="archive-title">'; echo single_cat_title(); echo '</h1>'; }
A few lines down, I added the following and it’s showing on every page. It’s not respecting the
if ( is_page( 21 ) )
part.add_action( 'genesis_before_content_sidebar_wrap', 'bw_blog_header' ); function bw_blog_header() { if ( is_page( 21 ) ) echo '<h1 class="archive-title">'; echo wp_title(); echo '</h1>'; }
If I add curly brackets inside the if statement of the second function, it doesn’t show on the pages where it shouldn’t, but it also doesn’t show on page 21.
Any ideas?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘if ( is_page() ) Showing on Every Page or Not Showing at All’ is closed to new replies.