Custom Field Filter in Shortcode

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 8 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #6299 Reply

    Hi there,

    I have a question regarding the shortcode usage.
    What I would like to accomplish is to use a shortcode within a page to show events featuring a certain value in a certain custom field key.

    Customfield key = Customer
    Customfield value = JohnSmith

    I could imagine that very shortcode looking something like this:
    [eo_events event_customfield_key=”Custom1″ event_customfield_value=”JohnSmith”]

    Would that be possible in some way or another?

    Thanks for your kind help!

    #6302 Reply

    Hi Linus,

    The event list shortcode passes all the attributes to eo_get_events() (itself a wrapper for get_posts() ). While I’ve not tested it, in theory the following should work:

    [eo_events meta_key="Custom1" meta_value="JohnSmith"]

    Of course, any more complicated meta queries, or queries involving multiple keys wouldn’t be possible.

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Custom Field Filter in Shortcode
Your information:

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see

<a href="" title="" rel=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width=""> <p style=""> <span style="">