Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter MarcusJeitler

    (@marcusjeitler)

    I registered a new shortcode in the plugin extension class that will be used as extension to the wpt_productions shortcode. After thinking about various approaches it seems that the easiest is to do something like this:

    $productions = $wp_theatre->productions->load($production_filters);
    $html = '';
    foreach ($productions as $production){
        foreach($production->events($event_filters) as $event){
            $html.=$production->html($production_args);
        }
    }
    return $html;

    While this fulfills my needs I am not completely satisfied as it changes the original behavior of the [wpt_productions] shortcode. A non intrusive solution would require an apply_filters hook for the return statement of the WPT_Productions::load function. Or is there a way I can implement this myself without that hook?

    If someone wants to have a look at the production & event data directly, the following query fetches all production posts with the corresponding event data:

    SELECT p.ID,
           p.post_type,
           p.post_title,
           wpt_event_key.post_id as "event_id",
           wpt_event.meta_key AS "event_meta_key",
           wpt_event.meta_value AS "event_meta_value"
    FROM wp_posts p
    JOIN wp_postmeta wpt_event_key ON wpt_event_key.meta_key = 'wp_theatre_prod' AND wpt_event_key.meta_value = p.ID
    JOIN wp_postmeta wpt_event ON wpt_event.post_id = wpt_event_key.post_id
    WHERE p.post_type = "wp_theatre_prod"
    ;

    Thread Starter MarcusJeitler

    (@marcusjeitler)

    I found your plugin extension example in the README file. Seems to be the right approach for this problem

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