Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Andy Mercer

    (@kelderic)

    The code below will add featured galleries to as many post types as you wish. It also will verify before adding that they really are post types still. (In case you later remove said post type).

    function add_featured_galleries_to_ctp( $post_types ) {
    	$postTypeArray = array( 'ctp1', 'ctp2', 'ctp3' );
    	$verifiedPostTypeArray = array();
    	$i = 0;
    	foreach ($postTypeArray as $postType) {
    		if( post_type_exists( $postType ) ) {
    			$verifiedPostTypeArray[i] = $postType;
    		}
    		$i++;
    	}
    	return $verifiedPostTypeArray;
    }
    add_action( 'fg_post_types', 'add_featured_galleries_to_ctp' );

    You’d add it to your functions.php file. However, it’s long because of the verification. I will be adding verification on the inside of the hook in the next update to this plugin, so pretty soon you’ll be able to not use the verification. At that point, the code you add to your functions.php file will be:

    function add_featured_galleries_to_ctp( $post_types ) {
    	return array( 'ctp1', 'ctp2', 'ctp3' );
    }
    add_action( 'fg_post_types', 'add_featured_galleries_to_ctp' );
    Thread Starter almamun

    (@almamun)

    Hi Andy,

    Thanks a lot. It worked!!

    Regards.

    Plugin Author Andy Mercer

    (@kelderic)

    Great! If you like the plugin, feel free to rate it as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No option to add gallery images in custom post type’ is closed to new replies.