- This topic has 15 replies, 3 voices, and was last updated 1 month, 2 weeks ago by
David.
-
AuthorPosts
-
March 21, 2022 at 6:11 pm #2162766
Quested
Hi
I want to add columns to my custom post type. I tried many times but its not working. Custom Post Type archive name is Projects.I already gone through this article. https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type
Kindly help.
Humble Regards
QuestedMarch 21, 2022 at 6:32 pm #2162778Ying
StaffCustomer SupportHi there,
Try this PHP snippet:
add_filter( 'generate_blog_columns', function( $columns ) { if ( 'projects' === get_post_type() && ! is_singular() ) { return true; } return $columns; } );
Make sure you’ve set the column setting at customizer > layout > blog.
March 21, 2022 at 11:37 pm #2162965Quested
Awesome.
Worked perfectly.
Thank you so much for the help.March 22, 2022 at 9:32 am #2163714Ying
StaffCustomer SupportYou are welcome 🙂
June 22, 2022 at 4:11 am #2261035Quested
Hi
I am redesigning another website from Divi to GeneratePress. I want to add columns to my custom post type. I tried many times but its not working. Custom Post Type archive name is Reviews.June 22, 2022 at 5:06 am #2261072David
StaffCustomer SupportHi there,
can you share the exact code you added ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 22, 2022 at 5:51 am #2261121Quested
I have given you temporary access to my site.
June 22, 2022 at 6:12 am #2261153David
StaffCustomer SupportWhere did you add the PHP Snippet ? I don’t see it on your site
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 22, 2022 at 6:19 am #2261164Quested
You can check the Theme Editor.
I added the code again.You can add or edit the code. You have full control.
June 22, 2022 at 6:22 am #2261169David
StaffCustomer SupportOk check now.
I changed the post type slug to
review
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 22, 2022 at 7:16 am #2261207Quested
Thank you so much for your help.
June 22, 2022 at 8:45 am #2261471David
StaffCustomer SupportYou’re welcome!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 24, 2022 at 5:46 am #2263174Quested
I want to add same 3 columns to my another custom post type. Custom Post Type archive name is Buyer Guides.
I have given you full access to check the code in Theme Editor. You can make the changes required.June 24, 2022 at 6:06 am #2263188David
StaffCustomer SupportChange this code:
add_filter( 'generate_blog_columns', function( $columns ) { if ( 'review' === get_post_type() && ! is_singular() ) { return true; } return $columns; } );
to this code:
add_filter( 'generate_blog_columns', function( $columns ) { if ( ( 'review' === get_post_type() || 'buyer-guides' === get_post_type() ) && ! is_singular() ) { return true; } return $columns; } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 24, 2022 at 6:08 am #2263190Quested
You guys are awesome.
Thank you so much for quick help. -
AuthorPosts
- You must be logged in to reply to this topic.