Site logo

Archived topic

Custom post type archive

13 replies · Started by Daniele on July 22, 2021

Viewing posts 1–14 of 14

Hi,
I created a CPT and I would like to display the posts in two columns, how can I achieve that?
Do I have to use css or any filter of the theme?

thanks!

thanks, worked

Glad to hear that!

Hello, I mean custom post type categories

Can you give the method a try?

Let me know if it works.

Hi Ying,
2 columns is already selected, but it does not work for the CPT categories.

I also used this snippet:

/* Add columns to cpt archives */
add_filter( 'generate_blog_columns','tu_portfolio_columns' );
function tu_portfolio_columns( $columns ) {
if ( is_post_type_archive( 'ricette' ) ) {
return true;
}

return $columns;
}

Hi Daniele,

Can you verify if the CPT slug used is correct?

We can help you check if you want. You can use the private information text field to provide backend access credentials. :D

Hi,
yes the slug is correct...
I will send you credentials in the private field...thanks!

Hi there,

try this snippet:

add_filter( 'generate_blog_columns', function( $columns ) {
    if ( 'ricette' === get_post_type() && ! is_singular() ) {
        return true;
    }

    return $columns;
} );

It perfectly worked. thanks David

You're welcome

This archived topic is closed to new replies.