• Hello there!

    I’m very confused by the coffee2code.com plugin to show custom field data… I’d like to use it in my sidebar to display 2 custom fields, ‘Location’ and ‘Date(s)’…

    At the moment I’m using the following snippet in my sidebar to list recent Exhibitions, and it’s here I’d like to add these custom fields, after the post_URL if possible:

    <li><h2>Exhibitions</h2>
    <ul>
    <?php c2c_get_recent_posts(5, "<li>%post_URL%</li>", "4"); ?>
    </ul>
    </li>

    Can anyone help me out on this?

    Cheers,

    James

    PS. I know how to do this inside a normal loop… it’s just in the sidebar that’s confusing me!
    <?php echo c2c_get_custom('Location'); ?>
    <?php echo c2c_get_custom('Date(s)'); ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The very first sentence from the plugin’s page:
    Easily retrieve and control the display of any custom field values/meta data for posts, inside or outside “the loop”.

    Thread Starter 3stripe

    (@3stripe)

    Heheh I got that bit moshu, but I can’t work it out at all in the context above I’m afraid, so just wondering if anyone has done this before?

    I’m not even sure if the plugin will do what I need it to in this case…

    Thread Starter 3stripe

    (@3stripe)

    This is proving tricky (mainly because I’m stupid haha).

    Use the function c2c_get_custom somewhere inside “the loop” and/or use the function c2c_get_recent_custom outside “the loop”; use ‘echo’ to display the contents of the custom field; or use as an argument to another function

    Have you tried c2c_get_recent_custom? What happens?

    Thread Starter 3stripe

    (@3stripe)

    Yes of course, I’m not that stupid… but I didn’t explain too well, so sorry for that.

    Ok here’s the science bit.

    ‘c2c_get_recent_custom’ seems to just pull out the most recently used words in that custom field… so in my case it just spits out a couple of recent entries into that custom field, without relating them to any post…

    “c2c_get_recent_custom(), as you know, works outside the loop, but in so doing it isn’t associated with any particular post. It gets the recent occurances of custom fields.”

    i’m gonna look for another plugin in case there’s an easier way forward here 🙂

    Thread Starter 3stripe

    (@3stripe)

    This has proved much harder than I imagined, sadly.

    For anyone else trying this, you might find my solution easier – just use the excerpt field to hold any extra information for your post (date/location etc) – as it is much easier to use this in the loop than custom fields!

    I have the very same problem, sadly.
    In my website I have a section of static pages regarding reviews, tales, long articles and such. In the review section I want to have in the sidebar (through a different page template and a different sidebar template) a box containing information regarding the movie or the book I’m reviewing. The point is: c2c_get_custom DOES NOT work OUTSIDE the loop, and the c2c_get_recent_custom shows only the most recent entries in a custom field. In this way, if I submit Review1 with, let’s say “Director: Steven Spielberg” and save, it shows just fine. But if I submit Review2 with “Director: John Woo”, it will show this last entry in the Review1 page too.
    How can we use this plugin to have individual custom fields values for each page? Is it possible?

    Thread Starter 3stripe

    (@3stripe)

    Abietto, I gave up on this I’m afraid, couldn’t even get any answers from the plugin author 🙁

    I’m trying to use this plugin to get an entry (which is a photo) to post as a background image (running a photoblog). Having no luck so far … wouldn’t mind somebody’s interest in helping out.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Using ‘Get Custom Field Values’ in sidebar’ is closed to new replies.