Placing an image in template tag: the_title()
-
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!
- The topic ‘Placing an image in template tag: the_title()’ is closed to new replies.