Support » Plugin: Events Manager » Custom Field needs PHP query –> can't figure out how

  • Resolved Nicky-Walraven

    (@nicky-walraven)


    Hey guys,

    I’ve been struggeling with this for a few days, can’t figure out how I’m supposed to do this.

    I have a custom field called band_naam wich is a custom field made with the custom fields plugin; and is a relation field. It grabs post-titles (based on a custom post type) and with the following PHP code creates a clickable link to that post.

    http://pastebin.com/Jsh4Nm2F

    I get that I need to implement the PHP somewhere (other than in the events-manager settings page) but I can’t gigure out where. I might have to create a custom template but I wouldn’t know where to call it.

    I have average PHP skills, if someone could point me in the right direction that would be great. The ammount of files in EventsManager plugin is overwhelming.

    https://wordpress.org/plugins/events-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • more info:
    I’ve added the _#ATT{band_naam} to the single-event box in the events-manager settings page; It outputs something, I’m guessing the post-id’s of the post called for by the field.

    Hiya,

    It would be better if you could tell us what you are actually aiming to do, so we can provide suggestions on the best course of action.

    Thanks,
    Phil

    Hiya Phil,

    I have an EventForm which I use for bandnights. I want to add the performing bands to it. Those bands have a band-page on my website, which is a custom post type (called band).

    I’ve added a custom field to the event custom post-type with Advanced Custom Fields plugin. This allows me to create relations between various posts based on the custom fields. I allready use the band_naam field on multiple pages. For instance: it links the cd-reviews by that band back to the band-page.

    I want the events to link back to the bandpage as well and vice versa

    Hope that makes it clear!

    Ok, so you just need to construct a URL that follows a format something like the one below?

    yoursite.com/bands/_#ATT{band_naam}/

    it seems that easy, but just putting _#ATT{band_name} gives this output

    <img src=”http://www.metalfrom.nl/wordpress/wp-content/uploads/2014/02/printscreen.jpg”>

    There are a couple of ways to do this. One way would be with code like this:

    global $EM_Event;
    echp $EM_Event->output(_#ATT{band_name})

    Because custom attributes are stored the same way as standard WordPress custom fields / meta data, you can also use get_post_meta:

    http://codex.wordpress.org/Function_Reference/get_post_meta

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Field needs PHP query –> can't figure out how’ is closed to new replies.