Forums

pingback+url and bloginfo is just my blog title. (5 posts)

  1. brentontherefore
    Member
    Posted 1 year ago #

    The following code in my header:

    <link rel="stylesheet" href="<?php bloginfo(’stylesheet_url’); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo(’name’); ?> RSS Feed" href="<?php bloginfo(’rss2_url’); ?>" />
    <link rel="pingback" href="<?php bloginfo(’pingback_url’); ?>" />

    is being output thusly:

    <link rel="stylesheet" href="Brenton Strine" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="Brenton Strine RSS Feed" href="Brenton Strine" />
    <link rel="pingback" href="Brenton Strine" />

    For some reason, all of the following:
    bloginfo(’stylesheet_url’);
    bloginfo(’name’)
    bloginfo(’rss2_url’);
    bloginfo(’pingback_url’);

    Are just returning my blog title!

  2. jonradio
    Member
    Posted 1 year ago #

    The parameters passed to bloginfo() must be enclosed in quotation marks, preferably single quotes. Otherwise, there would be no way to pass parameters in php variables.

    bloginfo(’stylesheet_url’); should be bloginfo(’'stylesheet_url'’); and so on.

    There are some examples here in the official documentation:
    http://codex.wordpress.org/Function_Reference/bloginfo
    The values allowed in the parameter are listed here:
    http://codex.wordpress.org/Function_Reference/get_bloginfo

  3. brentontherefore
    Member
    Posted 1 year ago #

    fixing that breaks the website and all i get is this error:

    unexpected T_STRING in /home/brenton/public_html/brentonstrine.com/wp-content/themes/barebones/header.php on line 10

    removing the quotes again fixes it. however, it's still not putting the URL to my site.

  4. jonradio
    Member
    Posted 1 year ago #

    Quotes are required, no question about that. Here is the WordPress-delivered line from the default theme's header.php. Cut and paste this to check it out for sure:
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

  5. brentontherefore
    Member
    Posted 1 year ago #

    Ok, I figured it out... there was some crazy encoding problem that was inserting invisible characters into bloginfo (92 00). I assume some program was trying to strip the quote marks and did so inconsistently, plus some encoding problem with the file.

    I don't know what character [92 00] is or if it's anything, but it's invisible and the only reason I found it was because I re-typed the same thing above and it worked, but when I pasted it (same thing, character for character, as far as I could see) it didn't work. When I copied both lines into a text editor, a little ? appeared, and that's when I looked at in in a binary editor and found the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic