Rewrite URL for only archive page (custom post type)

You can have a separate slug for the post type archive by setting the slug as the value for the has_archive argument, instead of just true: register_post_type( ‘event’, array( ‘has_archive’ => ‘agenda’, // etc. ) ); Now you can use single-event.php and archive-event.php for the single and archive views, but the URL for the archive … Read more

Custom post type and taxonomy permalinks – Structure

DID IT My problem was the miss code found in the array of the custom post type texturas_temp This: // Register Custom Post Type function texturas_temp() { $labels = array( ‘name’ => _x( ‘texturas_temp’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Textura’, ‘Post Type Singular Name’, ‘text_domain’ ), ‘menu_name’ => __( ‘texturas_temp’, ‘text_domain’ … Read more

CPT: archive-cpt.php VS custom page template

The correct way is latter one – correctly configure your CPT registration to have post type archive and use appropriate template file for it. However it gets tricker with your additional requirements. Exposing post type archives to be used in menus is significantly requested/explored topic, but I don’t think it made it into core yet. … Read more

How do I change the sql query for wp_get_archive()

Looking at the source code for wp_get_archives(), there is a filter called getarchives_join which you can use to restrict wp_get_archives() to a specific category You also need to get the current category ID, which is easy, simply use get_queried_object_id() You can try something like this to display archives for the currently viewed category add_filter( ‘getarchives_join’, … Read more