• Resolved skylinks

    (@skylinks)


    Might be a silly question but what I’m trying to do is display an archive of custom post type on the front page. I have one custom post type called “Projects” and there are many projects posts in it. I have created a template using elementor which is working fine in archive page. Now the problem is I want to set that archive as a front page.

    Is it possible with this plugin to display the archive on the front page? Any Guideline will be appreciated

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Micah Wood

    (@wpscholar)

    In general, that isn’t supported out of the box with this plugin. However, if you use a page builder like Elementor Pro or Beaver Builder Pro, you can create pages that loop through custom post types, and those pages can be assigned as your new front page.

    I do have another plugin that will allow you to customize the post types that show on your homepage (I need to update it, but it should work): https://www.ads-software.com/plugins/multiple-content-types/

    Thread Starter skylinks

    (@skylinks)

    @wpscholar
    Thank you so much for replying. I’ll really appreciate if you can update that plugin, It’s been 5 days I’m struggling with it. Trying different Snippets but till now nothing worked except one but there is an issue with that snippet Infinite scroll is displaying duplicate posts but if I use pagination it is displaying correct results.
    For that specific project, I want to use infinite scroll.
    I’m attaching it here maybe it helps

    /*
     * 1. Go to Settings > Permalinks and select any page as home page
     * Then use the following code
     *
     * You can add those codes in your functions.php in the theme, if you think your theme won’t be changed.
     * Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'.
     * If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, 
     * give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, 
     * so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.
     *
     * Just change the correct CPT name
     */
    
    add_action( "pre_get_posts", "archive_page_as_front_page" );
    function archive_page_as_front_page( $query ){
        if( is_admin() ) return;
    
        if( $query->get( 'page_id' ) == get_option( 'page_on_front' ) ){
            $query->set( 'post_type', 'projects' );
            $query->set( 'page_id', '' );
            $query->is_page = $query->is_singular = 0;
            $query->is_archive = $query->is_post_type_archive = 1;
        }
    }
    Plugin Author Micah Wood

    (@wpscholar)

    I just tested the plugin and it does still work. You can go to ‘Plugins’ > ‘Add New’ in the WordPress admin, select ‘Author’ from the dropdown, and then search for ‘woodent’. The ‘Multiple Content Types’ plugin will show up and you can install it. Once active, just visit the ‘Settings’ > ‘Reading’ and set your ‘Content types to show on the main blog and archive pages’.

    If it gives you any trouble, just post here and I’ll look into it: https://www.ads-software.com/support/plugin/multiple-content-types/

    Thread Starter skylinks

    (@skylinks)

    @wpscholar

    You are awesome! It solved my issue. I still can’t believe that a 4 years old plugin doing the job perfectly. Thank you so much for your kind support.

    Plugin Author Micah Wood

    (@wpscholar)

    No problem! I’m glad I could help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can I display Custom post type archive on front page?’ is closed to new replies.