- This topic has 3 replies, 2 voices, and was last updated 2 months, 1 week ago by
David.
-
AuthorPosts
-
May 30, 2022 at 6:42 am #2237966
Mi
Hello again,
i read a lot in the forum and found a lot of helpful stuff, but not exactly what I am looking for.
My website is based mostly on pages and because there are so many of them I want to add categorys and tags to them. I did this via adding this in the functions.php:function add_taxonomies_to_pages() { register_taxonomy_for_object_type( 'post_tag', 'page' ); register_taxonomy_for_object_type( 'category', 'page' ); } add_action( 'init', 'add_taxonomies_to_pages' ); if ( ! is_admin() ) { add_action( 'pre_get_posts', 'category_and_tag_archives' ); } function category_and_tag_archives( $wp_query ) { $my_post_array = array('post','page'); if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) ) $wp_query->set( 'post_type', $my_post_array ); if ( $wp_query->get( 'tag' ) ) $wp_query->set( 'post_type', $my_post_array ); }
Works perfect. – But now I can´t give the pages-previews in the archives-page the same design as the posts. (see here -> https://www.ffcorner.com/testwp/tag/tifa/ First Entry is a post, the next are pages)
I tried it with css and with the Colums to custom post types filter -> https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type
but I could´t get it to work.I didn´t want to try the WPSP, because I´ve read that there will be no more updates and that it is coming with the new GenerateBLock version. Should I wait for this or is there any other way I can go for now?
Thank you!
May 30, 2022 at 7:22 am #2238020David
StaffCustomer SupportHi there,
the GP blog columns apply to the
post
post type.
But we can filter in other post types using the snippet provided here:Which should be:
add_filter( 'generate_blog_columns', function( $columns ) { if ( 'page' === get_post_type() && ! is_singular() ) { return true; } return $columns; } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 30, 2022 at 7:50 am #2238191Mi
I already tried this ….. and it didn’t work. Now it does ^^’
Thanks a lot and sorry for the circumstances!May 30, 2022 at 8:03 am #2238206David
StaffCustomer SupportNo problems – glad to hear it is working!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.