Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] Remove Pagination from WordPress Archive in main LOOP only

$
0
0

Thanks, I just tried this but still get full count on footer widgets….

http://mff.siteflower.com/leadership/

I found a plug in that allows me to set a different pagination count for each cpt so I can set very high for leadership to hack a fix but would like to solve difinitively:

http://jeremyfelt.com/wordpress/plugins/custom-posts-per-page/

It uses a custom function which may be helpful:


	/**
	 * Backwards compatible (3.2.1) function to check for main query. In an ideal world, we'd
	 * tell you to buzz off and upgrade to at least 3.3.1, let alone the 3.4 that's just around
	 * the corner... but I'll be nice for one more release. Then I get to remove 15 lines. :) 
	 *
	 * @param $query object WP Query object
	 * @return bool Whether or not this is the main query
	 */
	public function check_main_query( $query ) {
		if ( method_exists( $query, 'is_main_query' ) ) {
			return $query->is_main_query();
		} else {
			global $wp_the_query;
			return $query === $wp_the_query;
		}
	}

//snip ....

/**
	 * This is the important part of the plugin that actually modifies the query before anything
	 * is displayed.
	 *
	 * @param $query WP Query object
	 * @return mixed
	 */
	public function modify_query( $query ) {

		/*  If this isn't the main query, we'll avoid altering the results. */
		if ( ! $this->check_main_query( $query ) || is_admin() )
			return;

		$cpppc_options   = get_option( 'cpppc_options' );
		$all_post_types  = get_post_types( array( '_builtin' => false ) );
		$post_type_array = array();
		foreach ( $all_post_types as $p=> $k ) {
			$post_type_array[] = $p;
		}
/ / .....


Viewing all articles
Browse latest Browse all 20145

Trending Articles