Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #532488

    Dear Enfold Team,

    I’ve successfully created a custom post type and enabled Layout Builder for it following this thread (https://kriesi.at/support/topic/procedure-for-adding-custom-post-type-and-enabling-it-for-use/)

    However, I’m missing the option for the magazine element to let it display custom post types (sort of like what’s possible with the Portoflio Grid Content Element)

    Can you advice in what to do, to enable this? PS. I’m a developer so code is fine with me, I just trust that you probably know where I should look.

    Thank you so much in advance!

    Kind Regards
    Yan Knudtskov

    #533019

    Hi yanknudtskov!

    Thank you for using Enfold.

    Did you manually created the custom post type or did you use a plugin? The magazine element will look for custom taxonomies of a custom post type. Make sure that you created a custom taxonomy.

    Regards,
    Ismael

    #533563

    Hmm that’s quite strange.

    I manually created the CPT and Taxonomy for the CPT with the code posted below.

    When I edit the magazine element, I only see the option to choose from ‘categories’ not one for any other.

    <?php
    
    /**
     * Add Taxonomy for Ugekurser
     */
    
    if ( ! function_exists( 'ugekurser_taxonomy' ) ) {
    	// Register Custom Taxonomy
    	function ugekurser_taxonomy() {
    
    		$labels = array(
    			'name'                       => _x( 'Ugekursus Kategorier', 'Taxonomy General Name', 'brandbjerg_theme' ),
    			'singular_name'              => _x( 'Ugekursus Kategori', 'Taxonomy Singular Name', 'brandbjerg_theme' ),
    			'menu_name'                  => __( 'Ugekursus Kategorier', 'brandbjerg_theme' ),
    			'all_items'                  => __( 'Alle Ugekursus Kategorier', 'brandbjerg_theme' ),
    			'parent_item'                => __( 'Forældre Ugekursus Kategori', 'brandbjerg_theme' ),
    			'parent_item_colon'          => __( 'Forældre Ugekursus Kategori:', 'brandbjerg_theme' ),
    			'new_item_name'              => __( 'Ny Ugekursus Kategori', 'brandbjerg_theme' ),
    			'add_new_item'               => __( 'Tilføj Ny Ugekursus Kategori', 'brandbjerg_theme' ),
    			'edit_item'                  => __( 'Redigér Ugekursus Kategori', 'brandbjerg_theme' ),
    			'update_item'                => __( 'Opdatér Ugekursus Kategori', 'brandbjerg_theme' ),
    			'view_item'                  => __( 'Se Ugekursus Kategori', 'brandbjerg_theme' ),
    			'separate_items_with_commas' => __( 'Adskil med kommaer', 'brandbjerg_theme' ),
    			'add_or_remove_items'        => __( 'Tilføj eller fjern ugekursus kategorier', 'brandbjerg_theme' ),
    			'choose_from_most_used'      => __( 'Vælg fra de mest anvendte ugekursus kategorier', 'brandbjerg_theme' ),
    			'popular_items'              => __( 'Poplære ugekursus kategorier', 'brandbjerg_theme' ),
    			'search_items'               => __( 'Søg Ugekursus Kategori', 'brandbjerg_theme' ),
    			'not_found'                  => __( 'Intet Fundet', 'brandbjerg_theme' ),
    			'items_list'                 => __( 'Ugekursus Kategori Liste', 'brandbjerg_theme' ),
    			'items_list_navigation'      => __( 'Ugekursus Kategori Liste Navigation', 'brandbjerg_theme' ),
    		);
    		$args = array(
    			'labels'                     => $labels,
    			'hierarchical'               => false,
    			'public'                     => true,
    			'show_ui'                    => true,
    			'show_admin_column'          => true,
    			'show_in_nav_menus'          => true,
    			'show_tagcloud'              => true,
    		);
    		register_taxonomy( 'ugekurser', array( 'ugekursus' ), $args );
    
    	}
    	add_action( 'init', 'ugekurser_taxonomy', 0 );
    }
    
    /**
     * Add Custom Post Type for Ugekursus
     */
    
    if ( ! function_exists('ugekursus_post_type') ) {
    
    	// Register Custom Post Type
    	function ugekursus_post_type() {
    
    		$labels = array(
    			'name'                  => _x( 'Ugekurser', 'Post Type General Name', 'brandbjerg_theme' ),
    			'singular_name'         => _x( 'Ugekursus', 'Post Type Singular Name', 'brandbjerg_theme' ),
    			'menu_name'             => __( 'Ugekurser', 'brandbjerg_theme' ),
    			'name_admin_bar'        => __( 'Ugekurser', 'brandbjerg_theme' ),
    			'parent_item_colon'     => __( 'Forældre Ugekursus:', 'brandbjerg_theme' ),
    			'all_items'             => __( 'Alle Ugekurser', 'brandbjerg_theme' ),
    			'add_new_item'          => __( 'Tilføj Nyt Ugekursus', 'brandbjerg_theme' ),
    			'add_new'               => __( 'Tilføj Ugekursus', 'brandbjerg_theme' ),
    			'new_item'              => __( 'Nyt Ugekursus', 'brandbjerg_theme' ),
    			'edit_item'             => __( 'Redigér Ugekursus', 'brandbjerg_theme' ),
    			'update_item'           => __( 'Opdatér Ugekursus', 'brandbjerg_theme' ),
    			'view_item'             => __( 'Se Ugekursus', 'brandbjerg_theme' ),
    			'search_items'          => __( 'Søg Ugekursus', 'brandbjerg_theme' ),
    			'not_found'             => __( 'Intet Fundet', 'brandbjerg_theme' ),
    			'not_found_in_trash'    => __( 'Intet fundet i papirkurven', 'brandbjerg_theme' ),
    			'items_list'            => __( 'Ugekursus Liste', 'brandbjerg_theme' ),
    			'items_list_navigation' => __( 'Ugekusus Liste Navigation', 'brandbjerg_theme' ),
    			'filter_items_list'     => __( 'Filtrér Ugekurser', 'brandbjerg_theme' ),
    		);
    		$args = array(
    			'label'                 => __( 'Ugekursus', 'brandbjerg_theme' ),
    			'description'           => __( 'Ugekursus Beskrivelse', 'brandbjerg_theme' ),
    			'labels'                => $labels,
    			'supports'              => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
    			'taxonomies'            => array( 'ugekurser' ),
    			'hierarchical'          => true,
    			'public'                => true,
    			'show_ui'               => true,
    			'show_in_menu'          => true,
    			'menu_position'         => 5,
    			'menu_icon'             => 'dashicons-calendar-alt',
    			'show_in_admin_bar'     => true,
    			'show_in_nav_menus'     => true,
    			'can_export'            => true,
    			'has_archive'           => true,		
    			'exclude_from_search'   => false,
    			'publicly_queryable'    => true,
    			'capability_type'       => 'page',
    		);
    		register_post_type( 'ugekursus', $args );
    
    	}
    	add_action( 'init', 'ugekursus_post_type', 0 );
    }
    #534051

    I’ve just investigated further and I realised it’s my mistake >.<

    I hadn’t added any entries into the new taxonomy, hence the Magazine element didn’t find any either. Once I added entries, it started showing.

    Thank you for the help! Have a great day and sorry for the inconvenience!

    #534055

    Hey!

    Glad you figured it out!
    For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
    And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
    For any other questions or issues, feel free to post them here on the forum and we will gladly try to help you :)

    Best regards,
    Yigit

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Magazine Content Element with Custom Post Types’ is closed to new replies.