Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter RobertMueller

    (@robertmueller)

    Hi Shazzad,

    just a quick update: After days of headaches I somehow managed to get both plugins working together.

    Not quite sure though as to why it’s working now…

    Deactivated Simply Exclude, reactivated and reconfigured (a little different than before) plus recreated the needed custom taxonomy with a different taxonomy name.

    So: Never mind and thanks again for your smart plugin!

    Robert

    Thread Starter RobertMueller

    (@robertmueller)

    Genius!
    Passing the posts_per_page argument does the trick!
    You saved may day! Thanks!

    – Set posts_per_page to -1 for displaying all posts without limit,
    – Removed ‘limit’ argument passed to get_tptn_pop_posts, since I don’t want any limit in number of posts and setting it to FALSE changed the ordering.

    By the way: Including a category filter in the standard shortcode and widget would be another killer feature of Top 10 in my opinion …

    Here’s the final code for anyone trying to reproduce thist solution:

    function tptn_shortcode_ablagesystem( $atts, $content = null ) {
    	if ( function_exists( 'get_tptn_pop_posts' ) ) {
    
    		$list ='';
    
    		$settings = array(
    			'daily' => TRUE,
    			'daily_range' => 30,
    			'strict_limit' => FALSE,
    		);
    
    		$topposts = get_tptn_pop_posts( $settings ); // Array of posts
    
    		$topposts = wp_list_pluck( $topposts, 'postnumber' );
    
    		$args = array(
    			'post__in' => $topposts,
    			'orderby' => 'post__in',
    			'post_type' => 'post',
    			'cat' => '4',
    			'posts_per_page' => '-1',
    		);
    
    		$my_query = new WP_Query( $args );
    		if ( $my_query->have_posts() ) {
    			$list = '<ul>';
    			while ( $my_query->have_posts() ) {
    				$my_query->the_post();
    				$list = $list . '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>';
    				wp_reset_postdata();
    			}
    			$list = $list . '</ul>';
    
    		} else {
    		}
    		wp_reset_query();
    		return $list;
    	}
    }
    add_shortcode( 'tptn_list_ablagesystem', 'tptn_shortcode_ablagesystem' );
    Thread Starter RobertMueller

    (@robertmueller)

    Ajay,

    thanks for your response!

    Set ‘limit’ => 10 — no effect at all…

    Is there maybe any other code in the plugin files that sets the limit to 5 as default, overriding this argument?

    Thanks,
    Robert

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