• Resolved mainewebworks

    (@mainewebworks)


    Hi,
    I’m developing a theme for a client.

    I made a “home” page (home.php slug “home”), showing the Page title with a small image at the end of the title.

    Example output: “My post title here <<|image|>>”

    The home.php is a WP “Page” and sits in my theme directory.

    But, when I use the same code in my index.php template for a Post, the image doesn’t show. I’ve tried a few different url approaches and can’t figure it out.

    Here’s the code:
    <h1 class="storytitle" id="post-<?php the_ID(); ?>"><?php the_title('', ' <img src="../fabrics/wp-content/themes/fabric/img/star.gif" alt="star" />'); ?></h1>

    It is the same code in both the Page using template home.php and a Post using index.php. “../fabrics/” is where word press is installed.

    Any thoughts as to why a post will not show the image next to the title while the home.php does?

    TIA!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Actually, “/fabrics/” is where it would be installed. It’s likely the directory traversal you’re attempting with the ‘..’ is the cause of your problem, especially if using custom permalinks.

    Thread Starter mainewebworks

    (@mainewebworks)

    Thank-you! I’m such a nerd. I knew having someone else’s help would do it.

    It works like I anticipated it to do. Funny that the “..” in front of the /url/ works for the home.php but not the index.php.

    I need to learn more about permalinks and related topics.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Placing an image in template tag: the_title()’ is closed to new replies.