Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Adding a variable to a link that’s inside a variable

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29276
    vincent
    Member

    Yeah, the topic probably doesn’t even sound right. This looks long, but I just wanted to explain it as much as I can. I think the fix for this problem literally takes like 1 minute.

    I’m trying to make it so that whatever is in the WordPress function bloginfo(‘description’); gets added to the end of this link $whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri="; which is inside a variable.

    bloginfo(‘description’); comes out to, let’s say csstricks when you call it. I need to make it so csstricks gets added to the end of the link in the $whaturl variable. So, ultimately, I’m looking to get the link: https://feedburner.google.com/api/aware … =csstricks. The reason this has to be dynamic is because I’m running the same sidebar which has the feedburner plain text feed count on several different blogs. I’m making each blog’s description the name that would come after uri= in the link so it would pull from that specific blog’s feedburner statistics. So, for instance, the description of another blog would be phptricks and there would be feed statistics for that feed at ttps://feedburner.google.com/api/awaren … =phptricks.

    I’m pretty sure it’s really easy and I’m barely missing it. I keep trying it but it just prints csstricks whenever I call bloginfo(‘description’); but I need to add it to the link instead of displaying it on the page. I’m newb at php :(

    Here’s the code that gets the plain text feedcount (remember, I’m trying to get the value of bloginfo(‘description’); appended to the end of $whaturl, ex: https://feedburner.google.com/api/aware … =csstricks):

    Code:
    feed->entry[‘circulation’];

    ?>

    And I call that with:

    Code:

    Which I need to come out to just a number.

    #78207
    cmoist
    Member

    The problem you’re facing, I believe, is that bloginfo(‘description’) is echoing the value. Try get_bloginfo(‘description’). It just returns the value, so you can use it within your PHP. Here is the WP page: Function Reference/get bloginfo

    To concatenate, or add it to the $whaturl variable, do something like the below:

    Code:
    #78568
    vincent
    Member

    Thanks for replying. I finally figured it out but decided not to use it because it looked like it was making the pages load a lot slower and I didn’t really need it.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.