• I have a secondary loop with $sec_query = new WP_Query( $args ); and want to format its posts using get_template_part() and pass variables to it as described in https://codex.www.ads-software.com/Function_Reference/get_template_part#Passing_Variables_to_Template
    However the documentation states that load_template() is used which takes the variables from $wp_query and not my $sec_query.
    I could use globals to pass variables, but it looks like the primary $post will get passed instead of the one set up by my the_post();.
    Am I right? If so, should there be a warning in the documentation? I haven’t tried yet!

  • The topic ‘Calling get_template_part from secondary loop’ is closed to new replies.