WordPress.org

Ready to get started?Download WordPress

Forums

I want to add an if statement to my header file (3 posts)

  1. wp.rook
    Member
    Posted 4 years ago #

    I want to add an id statement in my header template so that I can make it display a subtitle depending on which page (custom static page) it is displaying...

    I think I need something like: (although this doesn't work)

    <?php
    if(get_permalink(id) == 18 )
    {
    	print "<h1>hello world!!!</h1>";
    }
    ?>

    Can someone help?

  2. Jonathan Dingman
    Member
    Posted 4 years ago #

    I think you'd be better off doing something like this:

    if ( is_single(18) ) { ... }

    or if ( is_page(18) { .. }

    Take a look here for all the conditional statements.

  3. wp.rook
    Member
    Posted 4 years ago #

    thank you!!

Topic Closed

This topic has been closed to new replies.

About this Topic