• Resolved signsintime

    (@signsintime)


    I have a local WP install I’m working on and the header for the blog has a full width image with text overlay. This will be fine for all but 2 other pages of the site that need custom image/ text in this same position.

    I have a child theme where I have customized the default header, but I want to add the code for the 2 alternate pages into the header file using if/elseif/else statements and I’m new at writing this stuff so a little help would be greatly appreciate.

    Can someone please see if what I’m trying to do will work? Thanks!
    Jeri

    <?php if (is_page ( 'upcoming-conferences' )) {
    MY HTML CODE HERE;
    } elseif ( is_page ( 'in-the-news' )) {
    MY HTML CODE HERE;
    } else {
    THE DEFAULT HTML CODE HERE;
    } ?>

    I just tried it and got a blank white screen on all pages.

Viewing 1 replies (of 1 total)
  • Thread Starter signsintime

    (@signsintime)

    I found the answer for the proper format here:
    How to Write WordPress If Statements

    <?php if ( is_page('upcoming-conferences') ): ?>
    
       MY HTML FOR UPCOMING CONFERENCES HERE
    
    <?php elseif (is_page('in-the-news') ): ?>
    
       MY HTML FOR IN THE NEWS HERE
    
    <?php else: ?>
    
       MY HTML FOR HOME AND ALL OTHER PAGES HERE
    
    <?php endif ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Conditional statements for alternate page headers if, elseif, else’ is closed to new replies.