WordPress.org

Ready to get started?Download WordPress

Forums

Simple question about - is_page() (5 posts)

  1. zillion
    Member
    Posted 1 year ago #

    Hello all!
    I'm attempting to display an image on my page depending on what page is shown. I currently have the following code:

    http://pastebin.com/b79Uugay

    For some reason, it is completely refusing to work.
    Within Dreamweaver, if I take out all the img scr code, it displays no errors.

    Any suggestions? Very new to WordPress coding.
    Thanks!

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    have you checked the html code in teh browser, to see if the img tags are shown?

    where are the images located/saved?

    possibly try to use absolute image paths.

  3. dwnmedia sarl
    Member
    Posted 1 year ago #

    1st question : where are located your image ?

    I think this would be more correct depending where is your image but normally on your template folder :

    if(is_page('About'))
            {
                    <img src="<?php bloginfo('template_url'); ?>/image1.jpg">
            }

    2nd question: do you have a link to see the pb

  4. zillion
    Member
    Posted 1 year ago #

    Managed to fix it by placing my img src inside an echo statement:

    if(is_page('About'))
            {
                    echo '<img src="image1.jpg">';
            }
  5. Andrew
    Forum Moderator
    Posted 1 year ago #

    Good work Zillion.

Topic Closed

This topic has been closed to new replies.

About this Topic