• Hi, I want to archive page for my cusom post type( made with PODS).
    I try make teamplate for custom post type like Amit show in this post https://www.ads-software.com/support/topic/customized-post-format/
    1. I Copy partials/single folder under child theme and rename the ‘single’ folder to ‘website’.
    2. I copy the singular.php file into your child theme and add the below code after line 52.

    elseif ( is_singular( ‘website’ ) {
    get_template_part( ‘partials/website/layout’ );
    }

    Now I want to design my archive, I don’t know what file to edit

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    I didn’t test it but you can try it. It should work.

    Step 1. create a folder inside your child theme and copy the partials/entry folder. Rename it as you did previously for the single post or something like more organized partials/website/entry/layout.

    Step 2 – Copy index.php file into your child theme. You need to modify it a little bit so that it can work as per your need. Replace the line get_template_part( 'partials/entry/layout', get_post_type() ); with the below code and check it works or not.

    // Get post entry content
    if ( is_archive( 'website') ) {
        get_template_part( 'partials/website/entry/layout' );
    }
    
    // All other post types.
    else {
       get_template_part( 'partials/entry/layout', get_post_type() );
    }
    Thread Starter vinhxomdoi

    (@vinhxomdoi)

    I worked.
    But now my post archive had loaded partials/website/entry/layout.php too

    View post on imgur.com

    Hello,

    I just visited on your site and it seems your issue is resolved. If not, then try to deactivate the theme, then activate it back and now check it is working or not properly.

    Thread Starter vinhxomdoi

    (@vinhxomdoi)

    Thank you so much, but i decide to give up and use PODS shortcode( it’s kind of not good for SEO but it’s … easy ????).

    Okay, no problem. It totally depends on you. But I’ll test it out on my end.

    @apprimit I found this discussion when searching for the same problem as @vinhxomdoi.

    Your solution is indeed a way to achieve this, but there is a mistake in your code.

    is_archive() does not take any parameter.
    Instead, your should use is_post_type_archive('my-custom-post-type')

    The correct code would then be:

    
    if(is_post_type_archive('my-custom-post-type')){
        get_template_part( 'partials/entry-my-custom-post-type/layout', get_post_type() ); 
    }
    else{
        get_template_part( 'partials/entry/layout', get_post_type() ); 
    }
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to design archive for custom post type’ is closed to new replies.