Overriding WP_query per template

Home Forums Calendar Products Events Calendar PRO Overriding WP_query per template

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #682599
    northpointe
    Participant

    Is it possible to override the WP_query at the template level? I’d like to change specific view to have more posts per page just for one view. I’m playing with the agenda view ( https://github.com/moderntribe/tribe-events-agenda-view ), and I can’t override anything in the main query.

    #685726
    Brook
    Participant

    Howdy northpointe,

    Absolutely that is. We event have some example code that does just that here. Something like this ought to do it:

    add_action( 'tribe_before_get_template_part',  'modify_list_query'  );
    function modify_list_query( $template ) {
    if (strpos( $template, 'mini-calendar/list.php' )  === true) { // do magic }
    }

    Let me know if that helps, or if there is something more I can clarify. Cheers!

    – Brook

    #705024
    northpointe
    Participant

    Thanks! Working up some magic now!

    #705120
    Brook
    Participant

    Thanks for marking this resolved! Glad it worked.

    – Brook

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Overriding WP_query per template’ is closed to new replies.