Custom post type archive template missing

Viewing 4 posts - 1 through 4 (of 4 total)
  • #18494
    bigdrobek
    Participant

    Hello,
    I would like to setup own archive.php template for its custom post type. But it seems like you don’t use archive.php. I Can you advice me how to do this?

    Thank you,
    Radek

    WPMU 3.9.1,
    childtheme from Esplanade theme,

    #18500
    bigdrobek
    Participant

    I create new file archive-(custom_post_name).php, and I tried to copy inside the code from index.php.
    It works without styling, but works.

    Now I have trouble to activate featured image in post editor. I did some research and found that I have to put to my function.php this code:
    add_theme_support( 'post-thumbnails', array( 'post','custom_post_name' ) );

    But this not work for me πŸ™
    Any idea how to activate featured images?

    #18501
    bigdrobek
    Participant

    I got it, the mistake was in child theme functions.php

    Here is my function php to activate featured image metabox:
    Please check it, I just copy content form original and make small change.

    <?php
    /**
     * Load the theme options page if in admin mode
     */
    if ( is_admin() && is_readable( get_template_directory() . '/includes/theme-options.php' ) )
    	require_once( get_template_directory() . '/includes/theme-options.php' );
    
    if ( ! function_exists( 'esplanade_theme_setup' ) ) :
    /**
     * Set up theme specific settings
     *
     * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
     * @uses register_nav_menus() To add support for navigation menus.
     * @uses add_editor_style() To style the visual editor.
     * @uses load_theme_textdomain() For translation/localization support.
     * @uses add_image_size() To set custom image sizes.
     *
     * @since Esplanade 1.0
     */
    function esplanade_theme_setup() {
    	// Add support for post thumbnails and custom image sizes specific to theme locations
    	add_theme_support( 'post-thumbnails' );
    	add_image_size( 'slider-thumb', 640, 395, 1 );
    	add_image_size( 'blog-thumb', 268, 200, 1 );
    	add_image_size( 'teaser-thumb', 310, 190, 1 );
    	add_image_size( 'gallery-thumb', 100, 100, 1 );
    	add_image_size( 'video-thumb', 640, 395, 1 );
    	add_image_size( 'attachment-thumb', 700, 9999 ); // no crop flag, unlimited height
    }
    endif;
    ?>
    #19082
    noaneo
    Participant

    hi,

    http://www.wpbeginner.com/wp-tutorials/how-to-create-a-custom-post-types-archive-page-in-wordpress/

    in functions.php of child theme that put the code for your Featured Image, do not take the functions.php of the theme code parent.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.