• I’m trying to add code to one specific page out of all the other pages. Here’s the code:

    <?php
    // Header tagline insertion
    if ( get_the_id() != 3 ) { echo ?>
    <h1 class=”page-title”>/” title=”<?php the_title(); ?>”><?php the_title(); ?></h1>
    <?php } else { ?>
    <p class=”page-title”><img src=”<?php echo get_option(‘home’); ?>/wp-content/themes/brilliance/images/sttm-tagline.png” alt=”Tagline” /></p>
    <?php } ?>

    For some reason, this code is not working the way I was hoping! Basically, if the page id is not 3, it should add an H1 to the pages. If the id IS 3, it should add the image. I can’t make it work like I was hoping and I don’t know what’s wrong!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter micasuh

    (@micasuh)

    I’m thinking it has something to do with the else but I really don’t have enough php experience to know. Thanks for anything you can suggest.

    You need to use a function like this.

    if(is_page($ID)) {
    	some code here;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tag insertion using get_the_id()’ is closed to new replies.