• I am trying to replace the page titles with images as the client has a very specific- not google/web safe font they want used.

    I’m using a child theme off of twenty ten.

    I put this in the page.php file

    <h2><?php if (is_page('our-farm')) echo "<img src="Images/ourfarm.png"/>";
    elseif (is_page('about us')) echo "<img src="aboutus.jpg" />";
    else echo the_title(); ?></h2>

    but it caused an error on the site. What is the best way to do this using a child theme?

    Thanks.

    Niki

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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the error?

    Thread Starter mosini

    (@mosini)

    Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /hermes/bosweb/web152/b1521/ipg.nikitcom/testit/wp-content/themes/Driftless Edge Farm Theme/page.php on line 27

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try

    <h2><?php if (is_page('our-farm')) echo "<img src='Images/ourfarm.png'/>";
    elseif (is_page('about us')) echo "<img src='aboutus.jpg' />";
    else echo the_title(); ?></h2>

    Thread Starter mosini

    (@mosini)

    Thanks! That was it!

    I thought though that it would replace the title. Do you have a suggestion for the best way to do that (not screw up SEO) and to get rid of the white space between the title image and the text?

    Thanks again!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I would use @font-face for any weird and wonderful fonts clients request (make sure you have permission to use the font though).

    More info for font-face
    http://www.font-face.com/

    Maybe look for the font at Font Squirrel
    http://www.fontsquirrel.com/

    to get rid of the white space between the title image and the text

    Not sure what you mean

    Thread Starter mosini

    (@mosini)

    Thread Starter mosini

    (@mosini)

    with using @font-face. I have the font from the client in ttf format- do I just upload that my server and then use the font-face CSS rule?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    http://www.nik-it-test.com/driftlessedge/our-farm/

    You can see it there.

    You’ll need to remove the margin bottom and sort out the height on your heading 2 (<h2>), to reduce the spacing between these two headings.

    with using @font-face. I have the font from the client in ttf format- do I just upload that my server and then use the font-face CSS rule?

    This should help you with your font-face queries, http://www.fontsquirrel.com/fontface/generator/
    But yes, you use the ttf format with the generator & upload and use the font-face CSS rule.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Replace Page Title with an image’ is closed to new replies.