• Resolved Evan Brammer

    (@ebrammer)


    I have a custom field: tiny_embed that contains the Soundcloud shortcode for an audio file. I would like to have a page that does this:

    1. Pull just the shortcode from the tiny_embed custom field and display/execute the shortcode so that the soundcloud player is displayed.
    2. Pull and list the info from #1 only from custom post type: story and with the custom taxonomy of : storyline and the child: horror
    3. And it would be fantastic to be able to either choose to orderby another custom field (such as serial # or something) or even better, to be able to manually orderby using the post ID or customfield value, for example: orderby=”111, 115, 118, 105″ – with each of the #s representing a customfield number value I’ve assigned.

    Its a tall order for sure – but I’d love to get your input on accomplishing all/part of any of it.

    http://ww.wp.xz.cn/plugins/custom-content-shortcode/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    1. For the current post or inside a loop: [content field="tiny_embed" shortcode="true"] should work, please let me know if it doesn’t.

    2. This could be possible with the [loop] shortcode – currently it can’t query custom taxonomies, but I plan to add this parameter soon. Do you mean: to pull all posts in the post type story, whose taxonomy storyline equals horror, then display a list of their tiny_embed fields? For example:

    [loop type="story" taxonomy="storyline" value="horror"]
        [content field="tiny_embed" shortcode="true"]
    [/loop]

    Not sure if I understood correctly about the child parameter.

    3. This is also possible, if I add a new parameter (or two): order by numeric meta value. So, in the case of #2, what I imagine is like:

    [loop type="story" taxonomy="storyline" value="horror" orderby="meta_value_num" field="serial_number"]
        [content field="tiny_embed" shortcode="true"]
    [/loop]

    This would get all posts matching the query, then order them by the custom field serial_number.

    For the “manual orderby”, do you mean you’d like to pull posts with specific custom field values, i.e., all posts with value 111, then 115, 118, 105..? Or, if you mean post IDs, I suppose you could individually list them like so:

    [content id="111" field="tiny_embded"]
    [content id="115" field="tiny_embded"]
    [content id="118" field="tiny_embded"]
    [content id="105" field="tiny_embded"]
    ...

    Hmm, there must be an easier way.. One idea I had was: there is a plugin called Intuitive Custom Post Order, which lets you order posts by drag and drop, in the admin post list view. This way, you could visually order posts, then display the fields with orderby="menu_order".

    I think with the addition of a few parameters, it’s totally possible to display the content how you want. Certainly pushing the limits of this plugin, but it’s a good chance to improve it, so I’m interested in making it work. 🙂

    Thread Starter Evan Brammer

    (@ebrammer)

    Eliot,

    I’ll give those ideas a try. The custom taxonomy is definitely something I’d suggest you add since it seems more and more of us are moving towards them.

    There are many custom fields type plugins but they each seem to only do one thing that you need – what you seem willing to build (a much more comprehensive plugin) is what we need. Something that will let us use a shortcode on a page/post to display any data from any page.

    I look forward to hearing about your progress! Watching this space!

    Thread Starter Evan Brammer

    (@ebrammer)

    Eliot

    All is working well. Now if we can just get that custom taxonomy parameter to work – we’re golden.

    Anything I can do to encourage the speedy addition of this feature?

    Plugin Author Eliot Akira

    (@miyarakira)

    Hi Evan, sorry to have you waiting. I’ve started working on it – it should be a simple thing, but for some reason the parameters are not being recognized. I’ll start round 2 now – will update and let you know as soon as I get it working.

    Thread Starter Evan Brammer

    (@ebrammer)

    Well I think you’re awesome for taking on this challenge at all. That’s what I love about the WP community. Some of the best plugin developers are so willing to help us laymen accomplish what we need to.

    Plugin Author Eliot Akira

    (@miyarakira)

    OK, I think I got it. Please see version 0.3.4. I added:

    taxonomy and value – query for taxonomy=value
    orderby – meta_value (string), meta_value_num (number)
    keyname – which custom field to order by

    The following should get all posts of post type story, whose custom taxonomy storyline has the value horror, then order by the value of custom field called serial_number. Then, display (or run shortcodes from) the contents of their tiny_embed fields. Whew!

    [loop type="story" taxonomy="storyline" value="horror" orderby="meta_value_num" keyname="serial_number"]
        [content field="tiny_embed" shortcode="true"]
    [/loop]

    I did it quickly, so let me know if it’s working correctly for you.

    Thread Starter Evan Brammer

    (@ebrammer)

    You are speedy! Very nice. It worked just as you described it.

    I tried pushing it to see if it would work with subcategories, but couldn’t.

    It did work with the addition of tags, though.

    I’m an American teacher in Prague, CZ whose trying to build a website: http://www.sweetbriarstories.com so that I can transition from teaching to entrepreneur and you are being very helpful in that pursuit!

    What are your thoughts on the manually ordering posts by meta value (such as the serial #). We are publishing 52 stories in a storyline, 1 per week in a loop. So I am creating pages that list all the stories in order based on the week they subscribe. That means for those that start on week 34 I need to list stories 34-52 and then 1-33).

    I’d appreciate your thoughts on any of this.

    Plugin Author Eliot Akira

    (@miyarakira)

    Hi Evan, I’m glad the new parameters are working OK.

    What a coincidence, we both live in the same city! I’m also in a similar transition to go independent, and have been doing web work for a local graphic design firm. Would you want to meet up sometime for a chat over coffee, or tasty Czech beer? 🙂

    The website is looking inviting with a nice illustration, makes me curious what stories will be revealed inside. I’m thinking about what would be the best way to list posts as you described. Hmm, this is a mathematical or algorithm question..

    I think it’s a bit beyond the scope of the current plugin – unless you go the “brute force” method and create 52 pages (or perhaps it’s possible with fields..?) I was recently working on an events calendar, and there was a similar question about finding the week number of the year, recurring events like every 3rd Thursday of the month, etc. If I had more details, I could write a small custom plugin that calculates and lists the pages starting with the week the user subscribed. If you’d like, we can discuss over e-mail: miyarakira (at) gmail.com

    Plugin Author Eliot Akira

    (@miyarakira)

    By the way, for anyone else who may come across this thread, it’s not necessary to put shortcode="true" because shortcodes are executed by default.

    Also, I’ll look into adding support for subcategories for the next update.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Display oembed custom field’ is closed to new replies.