WordPress.org

Forums

Custom Content Type Manager
Conflict (5 posts)

  1. MikeNGarrett
    Member
    Posted 2 years ago #

    In search_filter() $query->set('post_type', $post_types); kills feeds from other plugins that have custom post types.

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. MikeNGarrett
    Member
    Posted 2 years ago #

    Change that.

    /includes/CCTM.php
    line 2253

    This kills ALL POST TYPES that aren't specifically registered with CCTM.

  3. MikeNGarrett
    Member
    Posted 2 years ago #

    How about we replace that foreach loop with something that only uses custom post types actually a part of CCTM?

    For example:

    foreach(self::$data['post_type_defs'] as $pt) {
    	if('page' == $pt && self::get_setting('pages_in_rss_feed')) {
    		// Leave pages in.
    	}
    	elseif($pt == 'post') {
    		// Do nothing.  Posts are always included in the RSS feed.
    	}
    	// Exclude it if it was specifically excluded.
    	elseif (!isset($pt['include_in_rss']) || !$pt['include_in_rss']) {
    		unset($post_types[$pt]);
    	}
    }
  4. MikeNGarrett
    Member
    Posted 2 years ago #

    That wasn't quite there yet.
    The function was still adding all these extra post types that really weren't wanted to the feed, so let's limit that to just posts and pages.

    public static function request_filter( $query ) {
    		if (isset($query['feed']) && (!isset($query['post_type']) || $query['post_type'] == 'post' || $query['post_type'] == 'page' || $query['post_type'] == array('post' => 'post') || $query['post_type'] == array('page' => 'page') )) {
    			$args = array( 'public' => true); // array('exclude_from_search'=>false); // ugh. WP has bad support here.
    			$post_types = get_post_types($args);
    			unset($post_types['revision']);
    			unset($post_types['nav_menu_item']);
    
    			if (defined('CCTM_DEBUG') && CCTM_DEBUG == true) {
    				$myFile = "/tmp/cctm.txt";
    				$fh = fopen($myFile, 'a') or die("can't open file");
    				fwrite($fh, 'Request post-types:'. print_r($post_types, true));
    				fclose($fh);
    			}
    /*  Old foreach
    			foreach ($post_types as $pt) {
    				if('page' == $pt && self::get_setting('pages_in_rss_feed')) {
    					// Leave pages in.
    				}
    				elseif($pt == 'post') {
    					// Do nothing.  Posts are always included in the RSS feed.
    				}
    				// Exclude it if it was specifically excluded.
    				elseif (!isset(self::$data['post_type_defs'][$pt]['include_in_rss']) || !self::$data['post_type_defs'][$pt]['include_in_rss']) {
    					unset($post_types[$pt]);
    				}
    			}
    */
    			foreach(self::$data['post_type_defs'] as $key => $pt) {
    				if('page' == $pt && self::get_setting('pages_in_rss_feed')) {
    					// Leave pages in.
    				}
    				elseif($pt == 'post') {
    					// Do nothing.  Posts are always included in the RSS feed.
    				}
    				// Exclude it if it was specifically excluded.
    				elseif (!isset($pt['include_in_rss']) || !$pt['include_in_rss']) {
    					unset($post_types[$key]);
    				}
    			}
    			$query['post_type'] = $post_types;
    
    		}
  5. fireproofsocks
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for looking into this so deeply. That filter has been problematic. Please file a bug report for this -- the forums are not a good place to report bugs/fixes: http://code.google.com/p/wordpress-custom-content-type-manager/issues/list

    Please include your code, too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Content Type Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic