Archived topic
Formatting CPT Posts in Archives/Search
5 replies · Started by Suggie on March 15, 2018
Hi guys. I did a search on this topic and found a bit of information, but being new, I just can't quite grasp what is being said. Hoping you can put into layman's terms for me!
I used CPTUI plugin to create a custom post type. I then utilized the info on the link below to get Wordpress to merge regular and CPT for categories and tags. Now, when I click on a category, it does list the CPT along with my other posts....however...the formatting is different for the CPT. How can I get it to match what I have for the regular posts?
The website URL I included in this submission is an example. The CPT has the title "I Can't Make This Up..." As you can see, the formatting is different.
Hoping it's an easy fix.
Hi there,
Can you try adding this function?:
add_filter( 'generate_blog_columns', 'tu_book_review_columns' );
function tu_book_review_columns( $columns ) {
if ( 'book_review' == get_post_type() ) {
return true;
}
return $columns;
}
Let me know :)
Thank you, Tom. That sort of did the trick. The CPT post is now showing up in the column format, but it doesn't include any metadata (date, category, tags).
One other follow-up (and please let me know if it should be a separate ticket): The CPT post doesn't show up in the Search archive. Can I add to that as well?
Thanks again for your awesomeness!
For the meta data, this topic should help: https://generatepress.com/forums/topic/custom-post-type/
For the CPT search, this article should help: https://webdevstudios.com/2015/09/01/search-everything-within-custom-post-types/
Let me know :)
Thanks, Tom. I'll give those posts a try. One more question. and one that seems dumb to me, but I can't quite figure it out. :)
Currently for my blog page, I'm using Elementor to just list all posts by date. How can I do that with GeneratePress if I don't want to use Elementor for that purpose? Can I use the above information about CPT search for this issue as well or is that only limited to search?
Example: https://thegassysquirrel.com/blog
Thanks a bunch!
You can use the standard WP/GP blog by setting the "Posts page" to an empty page in "Settings > Reading".
Then you can configure your blog options in Customize > Layout > Blog, which includes columns etc..
Let me know if you need more info :)