Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter MikeNGarrett

    (@mikengarrett)

    Change that.

    /includes/CCTM.php
    line 2253

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

    Thread Starter MikeNGarrett

    (@mikengarrett)

    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]);
    	}
    }

    Thread Starter MikeNGarrett

    (@mikengarrett)

    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;
    
    		}
    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    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: https://code.google.com/p/wordpress-custom-content-type-manager/issues/list

    Please include your code, too.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Content Type Manager] Conflict’ is closed to new replies.