Ecommerce Shopify WordPress Discussion

How do I create an archive for a CPT

I have created a CPT (Custom Post Type) in Wordpress called "minutes" and am using the following php to give the post an archive add_filter( 'getarchives_where', 'getarchives_where_filter', 10, 2 ); add_filter( 'generate_rewrite_rules', 'generate_events_rewrite_rules' ); function getarchives_where_filter( $where, $args ) { if ( isset($args['post_type']) ) { $where = "WHERE post_type = '$args[post_type]' AND post_status = 'publish'"; } return $where; } function generate_minutes_rewrite_rules( $wp_rewrite ) { $event_rules = array( 'minutes/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?post_type=minutes&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 'minutes/([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?post_type=minutes&year=$matches[1]&monthnum=$matches[2]', 'minutes/([0-9]{4})/?$' => 'index.php?post_type=minutes&year=$matches[1]' ); $wp_rewrite->rules = $minutes_rules + $wp_rewrite->rules; } function get_archives_minutes_link( $link ) { return str_replace( get_site_url(), get_site_url() . '/minutes', $link ); }; and to create a monthly side bar on my single post template. I am using this: add_filter( 'get_archives_link', 'get_archives_minutes_link', 10, 2 ); wp_get_archives( array( 'post_type' => 'minutes' ) ); wp_get_archives( array( 'post_type' => 'minutes', 'type' => 'yearly' ) ); wp_get_archives( array( 'post_type' => 'minutes', 'type' => 'monthly' ) ); wp_get_archives( array( 'post_type' => 'minutes', 'type' => 'daily' ) ); remove_filter( 'get_archives_link', 'get_archives_minutes_link', 10, 2 ); I have resaved the permalinks but the monthly links dont link to the archive. any ideas?
https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-post-types add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'minutes', array( 'labels' => array( 'name' => __( 'Minutes' ), 'singular_name' => __( 'Minute' ) ), 'public' => true, 'has_archive' => true, ) ); } Make sure 'has_archive' => true Then, create an archive-minutes.php file. This will be the archive for the minutes page. In that page, use the default wordpress loop, or whatever you want to get the content if ( have_posts() ) : /* Start the 'WORDPRESS LOOP' */ while ( have_posts() ) : /* Might be one or the other vased on your setup. */ the_post(); get_post_type(); endwhile; else : echo 'No Minutes CPT posts created yet.'; endif;

January 7, 2024

It appears like this question is somewhat similar to what you need. Please check below answer and update your code for "minutes" post type. Custom post type yearly/ monthly archive Hopefully, you will get your issue resolved with this. I am not adding the same code again here.

January 7, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.