• Resolved eurekainfo

    (@eurekainfo)


    <h1 class=”headline__primary” style=”margin-right: -0.1em; letter-spacing: 0.2em; opacity: 1; -webkit-transform: matrix(1, 0, 0, 1, 0, 0);”>Bellefull</h1>

    i am trying to place a conditional statement in my theme’s php code to display an image on a particular page instead of the normal header text that it displays on all the other pages. but i want this for only one page. so i found the right file to edit under Apearance > Editor but when i edit the php code i am getting the following screen: https://s10.postimg.io/hmeud12rt/error.png

    seems there is a mistake somewhere in my code. as i see the code is not being read as code but as text. here is the exact php script i entered. i entered it where the string calling the initial header is supposed to be. i just replaced that script with this one:

    if ( ! is_page(‘598’) ) {
    echo ‘<img class=”marginn” src=”https://www.bellefullcatering.com/wp-content/uploads/2016/08/Bellefull-Logo-NEW.png&#8221; alt=”” width=”300″ height=”179″>’
    }

    else {
    echo ‘<h1 class=”headline__primary”><?php esc_html_e( $title ) ?></h1>’
    }

    pls can someone show me what is wrong with my code and why it wouldnt display properly. thanks very much.

    using Rosa Restaurant theme and i cant send links to the page because it is being worked on locally. thanks very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Looks like you need to wrap your code in PHP tags…

    <?php
    
    if ( ! is_page('598') ) {
    echo '<img class="marginn" src="https://www.bellefullcatering.com/wp-content/uploads/2016/08/Bellefull-Logo-NEW.png" alt="" width="300" height="179">'
    }
    
    else {
    echo '<h1 class="headline__primary"><?php esc_html_e( $title ) ?></h1>'
    }
    
    ?>

    Thread Starter eurekainfo

    (@eurekainfo)

    i tried that already but it only brings a blank page as below:
    https://s16.postimg.org/3rjawqv39/blank.png

    the whole website becomes blank like this when i apply the php tag

    Thread Starter eurekainfo

    (@eurekainfo)

    figured it out. here’s the script that eventually worked:

    <?php
    if ( is_page(‘598’) ) {
    echo ‘<img class=”marginn” src=”https://www.website-here.com/wp-content/uploads/2016/08/image.png&#8221; alt=”” width=”300″ height=”179″>’;
    }

    else {
    echo ‘<h1 class=”headline__primary”>’ . $title . ‘</h1>’;
    }
    ?>

    Thread Starter eurekainfo

    (@eurekainfo)

    excellent…thanks…wish i had seen this few hours ago.would ahve saved me a lot of time…thanks very much though

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show Different Header for one particular page’ is closed to new replies.