WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding bloginfo tag within comments_popup_link (2 posts)

  1. hephaistion
    Member
    Posted 5 years ago #

    I had a problem with non-homepage, non-post images being broken after enabling custom permalinks. I solved this as far as my header image was concerned by adding bloginfo('template_directory'); before my image directory.

    However, the image I use for comments also suffered from the permalink change. At first I stupidly cut and paste before realising I had php tags within php tags resulting in a t-string error.

    Since, I have tried adding curly braces, parentheses, single and double quotes all to no avail.

    In the grand scheme of things this is a small problem but a very annoying and niggly one. Here's how I left my code:

    comments_popup_link('', '<img src="{bloginfo('template_directory');}/images/comment12x12.gif" alt="comment" width="12" height="12" /> 1 comment', '<img src="{(bloginfo('template_directory');}/images/comment12x12.gif" alt="comment" width="12" height="12" /> % comments');

    (This is from my category page where I only want existing comments displayed, hence the missing 'No comments')

    Thanks for any insight you might offer.

  2. hephaistion
    Member
    Posted 5 years ago #

    Found my solution on Sitepoint. Just had to use get_bloginfo instead, phew.

    comments_popup_link('', '<img src="' . get_bloginfo('template_directory') . '/images/comment12x12.gif" alt="comment" width="12" height="12" /> 1 comment', '<img src="' . get_bloginfo('template_directory') . '/images/comment12x12.gif" alt="comment" width="12" height="12" /> % comments');

    Hope this might help others along the way.

Topic Closed

This topic has been closed to new replies.

About this Topic