Support » Plugin: Get Custom Field Values » [Plugin: Get Custom Field Values] Using quotes

  • Resolved Joe Siegler


    I just ran across this plugin tonight. It’s quite awesome. After reading a few of the remarks from others here, this need to be in the base code. It’s seriously kickass.

    I also use the Genesis Simple Edits plugin. Between the two of them – man, it’s some serious power without touching a template. Gotta love that.

    Anyway, I was running into an issue tonight in trying to implement a code. The problem is the custom field I’m using. It’s a URL, and as such, the custom field code I”m trying to construct needs quotes, but that makes the plugin not work right.

    Basically, here’s what I constructed, but it doesn’t work right for obvious reasons.

    [custom_field field="MLBURL" this_post="1" limit="0" before=" | <a href="" after="" target="_blank"> Recap</a>" between=", " /]

    There any way around this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • OK, I played around with it a bit. I’m getting close, but can’t figure out the right string.

    Here’s what’s in SOME posts (basically a post I make about a game recap). The custom field is MLBURL, and the contents look like this:

    If you want to see exactly what this generates, look at the old version of my website (I’m moving from Movable Type to WordPress).

    In the top there’s a link, “Game Recap on”, of which the MLBURL custom code is used for the link.

    The closest I’ve gotten with this Custom Field Values is with this code:

    [custom_field field="MLBURL" this_post="1" limit="0" before=" | <a href=&quot;" after="&quot; target=&quot;_blank&quot;> Recap</a>" between=", " /]

    Using that code generates the following: (The new in progress test site link).

    If you hover over the recap link, you’ll see it generates a malformed URL, but the rest of the code is working, as it displays the text I want, links to another window, etc. Just the actual used URL isn’t right.

    I’ve played with the shortcode syntax a bit, and got the resultant URL close, but not right. Anyone know how to get around this? I’ll keep playing with it, but if someone has a suggestion, I’d appreciate it.


    Worked it out. One extra quot was causing the problem. This works for me.

    [custom_field field="MLBURL" this_post="1" limit="0" before=" | <a href=" after="&quot; target=&quot;_blank&quot;> Recap</a>" between=", " /]

    I repeat again – this plugin, combined with Genesis Simple Edit from Studiopress gives me some stupid powerful really easy customization.

    Plugin Author Scott Reilly


    WordPress & Plugin Developer

    Glad the plugin has been of use to you!

    As you’ve figured out, quotes that you want to send as part of the value of a shortcode attribute (field, before, after, between) need to be encoded. Otherwise, the shortcode parser for WP has problems making sense of the shortcode.

    It’s a good point though, so I’m going to add an explanation to the FAQ to help others in the future.

    or just use single quotes instead of double-quotes for one or the other. for example, if the custom field value has either single or double quotes in it. (haven’t tested all scenarios)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Get Custom Field Values] Using quotes’ is closed to new replies.