• I am writing a plugin that is a attaching some code to the end of the_contnet. This code contains and image that is in the theme images directory.

    I am trying to call the location of the theam directory using: –

    return ($value . “<img src=\”” . bloginfo(‘template_url’); . “/images/rating_full_” . get_post_meta($post->ID, ‘review_rating’, true) . “.jpg\” />”);

    Whilst this dose display the URL it dose so, not within the SRC attribute of my images, where it should be, but at the top of the post, breaking my image. Any idea what I am doing wrong?

Viewing 1 replies (of 1 total)
  • I had the same problem, and actually came up with the solution while I was writing this very post.

    I’was writing a simple plug-in, on witch I needed to call a JavaScript.

    I was coding this:

    ′echo “<script> var ImPath=\” “. bloginfo(‘template_url’) .” \”</script>”;′

    And I was getting this:

    ′<script>https://myURL/wp-content/themes/mac2CAdvvar ImPath=” “</script>′

    Like neotoxic said, the URL was always in the beginning of the line on where it was invoked. So I played along:

    And I coded this:

    ′echo “<script”;
    echo “var ImPath=\” “;
    echo bloginfo(‘template_url’);
    echo “\”</script>”; `

    Finally got this:

    ′<script>var ImPath=”https://myURL/wp-content/themes/mac2CAdv”</script&gt; ′

    It’s simple, just isolate the ′echo bloginfo(‘template_url’);′ in a single line!

    Hope this helps someone in the future!

    MAC

Viewing 1 replies (of 1 total)
  • The topic ‘Callig bloginfo from plugin’ is closed to new replies.