Pagination not working with custom loop

I’ve run into this problem with PageNavi before. My solution is to hijack the $wp_query variable temporarily and then reassign it after closing the loop. An exmaple: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args=array( ‘post_type’=>’post’, ‘cat’ => 6, ‘posts_per_page’ => 5, ‘paged’=>$paged ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query($args); /* … Read more

Initialize add_action() for every copy of a specific shortcode

You can pass values by adding your own filter. Proof of concept: add_filter( ‘my_filter’, function() { return array(1,2,3); } ); function print_partners_scripts() { $args = apply_filters(‘my_filter’,null); var_dump($args); } add_action( ‘wp_footer’, ‘print_partners_scripts’ ); Where you to register and enqueue your script instead of echoing it directly to the page, you could use wp_localize-script to pass information … Read more

Widget header unique classes

please study the RELATED links here in the right sidebar. http://codex.wordpress.org/Function_Reference/register_sidebar refer to this line: ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’, %1$s outputs an id specific to the widget type; %2$s outputs a widget specific class including an unique number.

meta_query compare not doing what I want it to do

Your code looks valid for me. The only thing you can try is ‘NUMERIC’ instead of ‘numeric’ and to cast $current to int as date() will return a string. $current = (int)date(‘Ymd’); To debug this further you can place this directly under your code: global $wpdb; var_dump( $wpdb->last_query ); You’ll then have the complete query … Read more

how to add pagination and post query in taxonomy-taxonomy-term.php? [duplicate]

The problem is that you’re not letting the template file do what it is intended to do. Instead of outputting the default loop, you’re ignoring the default loop, and outputting a custom query loop. Replace all this: <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); if(!empty($wp->query_vars[‘term’])){ $terms = $wp->query_vars[‘term’]; $taxonomy = ‘term’; } … Read more