- This topic has 8 replies, 3 voices, and was last updated 3 months, 2 weeks ago by
Tom.
-
AuthorPosts
-
September 25, 2020 at 2:41 am #1458164
Eaydman
I have a custompost type called Video, and added a custom tax called video-category.
How do I make a archive page that works with my post type ?
Im running All the newest beta of GeneratePress theme and Pro version.
September 25, 2020 at 3:32 am #1458226David
StaffCustomer SupportHi there,
does your CPT include the
'has_archive' => true,
argument ?Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 25, 2020 at 5:46 am #1458372Eaydman
Ah no – It was false, but have change it to true now.
On my page domain.com/video-category/tax-slug/ I still get “Nothing Found”This is how my settings looks link in the CPT.
$args = array(
‘label’ => __( ‘video’, ‘xxxxx’ ),
‘description’ => __( ”, ‘xxxxx’ ),
‘labels’ => $labels,
‘menu_icon’ => ‘dashicons-screenoptions’,
‘supports’ => array(‘title’, ‘editor’, ‘revisions’, ‘thumbnail’, ‘author’, ‘custom-fields’, ),
‘taxonomies’ => array(),
‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘menu_position’ => 5,
‘show_in_admin_bar’ => true,
‘show_in_nav_menus’ => true,
‘can_export’ => true,
‘has_archive’ => true,
‘hierarchical’ => false,
‘exclude_from_search’ => true,
‘show_in_rest’ => true,
‘publicly_queryable’ => true,
‘capability_type’ => ‘post’,
‘rewrite’ => array(‘slug’ => ‘video’),
);What do I then do ?
September 25, 2020 at 1:20 pm #1459133David
StaffCustomer SupportYou will need to create a copy of the themes archive.php template and place that in your child theme folder.
The new archive will need to match the rewrite slug you have added to your template.
eg.archive-video.php
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 30, 2020 at 5:33 am #1465125Eaydman
I have copyed the “archive.php” and renamed it to “archive-video.php” in the child theme.
But i still get the “Nothing Found”.
Do i have to make some changes to the “archive-video.php” file ?September 30, 2020 at 6:41 am #1465234Eaydman
Or http://www.domain.com/video/ works fine, that show an archive page for all the post in that post-type.
But I have a Custom-Post-Type (Video), where I have added a custom Tax named (video-category).
So when I make a link to a Custom Tax. http://www.domain.com/video-category/cat-name that page says: “Nothing Found”
September 30, 2020 at 7:57 am #1465497David
StaffCustomer SupportThis article explains:
https://premium.wpmudev.org/blog/add-custom-post-types-to-tags-and-categories-in-wordpress/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 1, 2020 at 1:18 am #1466640Eaydman
I added the code:
function add_custom_types_to_tax( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars[‘suppress_filters’] ) ) {// Get all your post types
$post_types = get_post_types();$query->set( ‘post_type’, $post_types );
return $query;
}
}
add_filter( ‘pre_get_posts’, ‘add_custom_types_to_tax’ );But my CPT Custom Tax is still showing “Nothing Found” on http://www.domain.com/custom-tax/tax-name
October 1, 2020 at 10:21 am #1467735Tom
Lead DeveloperLead DeveloperThis should all happen automatically without the need for functions or custom templates.
Have you try re-saving your permalinks in “Settings > Permalinks”?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.