Add number in increment of one to DIV ID

the code should be instead add_shortcode( ‘faq’, ‘wpse105856_shortcode_callback’ ); function wpse105856_shortcode_callback( $atts ) { extract( shortcode_atts( array( ‘category’ => ” ), $atts ) ); $args = array( ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘post_type’ => ‘faq’ ); if ( ! empty( $category ) ) { $args[‘category_name’] = $category; }; $posts = get_posts( … Read more

Pagination for event query

posts_nav_link() works off the main query. Instead of invoking your own $upcoming, just use query_posts( … ) to temporarily overwrite it, and the corresponding template tags… query_posts( array( ‘post_type’ => ‘tribe_events’, ‘eventDisplay’ => ‘upcoming’, ‘posts_per_page’ => 1, ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php tribe_get_template_part( ‘list/single’, ‘event’ … Read more

Nested loop called with shortcode duplicating the content above the main loop

You have few errors in your code. Below you can see how it should look like: function cd_random_testimonial($atts) { // EXAMPLE USAGE: // [loop the_query=”showposts=1&post_type=testimonials&orderby=rand”] // Defaults extract(shortcode_atts(array( ‘the_query’ => ” ), $atts)); // de-funkify query $the_query = preg_replace(‘~&#x0*([0-9a-f]+);~ei’, ‘chr(hexdec(“\\1”))’, $the_query); $the_query = preg_replace(‘~&#0*([0-9]+);~e’, ‘chr(\\1)’, $the_query); // query is made $my_query = new WP_Query( $the_query … Read more

Inserting random posts

Combining two different custom post types in one single query, and still being able to control the number of each type of posts to be displayed can be a little tricky. If one single query is used with post_type = array( ‘type1’, ‘type2’…. ), you have to set posts_per_page to a considerably high number. Which … Read more