• Hello,

    How to customize the Blog entries for a custom post type?
    It’s possible on other themes by archive.php file.

    Thanks

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

    To do it, you need to create an archive template using the Oceanwp child theme.
    1. Install and activate child theme
    2. Copy the oceanwp > partials > entry folder into the child theme following the same path.
    3. Rename the copied folder.
    4. Copy the index.php file into the child theme and edit the code to show the custom archive template.
    5. Now open the copied folder files and customize it as per your need.

    Thread Starter verseleo

    (@verseleo)

    Thanks @apprimit

    If possible, please elaborate more on number 4.
    When I change the Layout path to CPT on row 75, I see the white page.

    // Get post entry content
    get_template_part( 'partials/entry/layout', get_post_type() ); ?>
    Thread Starter verseleo

    (@verseleo)

    Hi again,

    It’s possible to implement one of the widgets on the sidebar (for example “recent posts”) on the page or CPT?

    Thread Starter verseleo

    (@verseleo)

    Hi again,

    By creating a new file in the root directory and name it to archive-cpt.php and copying the index file on it, CPT is successfully run through archive-cpt.php.
    In fact, currently, only I want to change the blog style to thumbnail style for the archive template of CPT.
    I don’t know that how to call thumbnail style for CPT on OceanWP 😐

    Please assist me.
    Thanks

    Try to add the below code to the child theme’s functions.php file to do that –

    function prefix_custom_blog_style( $style ) {
        if ( is_archive('your-cpt-name') ) {
             $style = 'thumbnail-entry';
         }
         return $style;
        }
    add_filter( 'ocean_blog_entry_style', 'prefix_custom_blog_style' );
    Thread Starter verseleo

    (@verseleo)

    Thanks @apprimit for the reply.

    By adding the code, all archive templates pages include (tags, category,…) are changed to thumbnail-entry except the Home page.

    Problem wasn’t solved by adding below code:

    else {
             $style = 'grid-entry';
         }
    • This reply was modified 4 years, 2 months ago by verseleo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customize the Blog entries for CPT’ is closed to new replies.