Wordpress - archives for CPT
How do I make an wordpress - archives for cpt?
What is a wordpress - archives for cpt? How do you make a wordpress - archives for cpt? This script and codes were developed by Cory Schadt on 19 October 2022, Wednesday.
Wordpress - archives for CPT - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wordpress - archives for CPT</title>
</head>
<body> to functions
add_filter( 'getarchives_where', 'getarchives_where_filter', 10, 2 );
add_filter( 'generate_rewrite_rules', 'generate_newsr_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_newsr_rewrite_rules( $wp_rewrite ) { $newsr_rules = array( 'news-releases/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?post_type=news-releases&year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 'news-releases/([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?post_type=news-releases&year=$matches[1]&monthnum=$matches[2]', 'news-releases/([0-9]{4})/?$' => 'index.php?post_type=news-releases&year=$matches[1]' ); $wp_rewrite->rules = $newsr_rules + $wp_rewrite->rules;
}
function get_archives_newsr_link( $link ) { return str_replace( get_site_url(), get_site_url() . '/news-releases', $link );
};
to template
<?php
add_filter( 'get_archives_link', 'get_archives_newsr_link', 10, 2 );
wp_get_archives( array( 'post_type' => 'news-releases', 'type' => 'yearly' ) );
wp_get_archives( array( 'post_type' => 'news-releases', 'type' => 'monthly' ) );
wp_get_archives( array( 'post_type' => 'news-releases', 'type' => 'daily' ) );
remove_filter( 'get_archives_link', 'get_archives_newsr_link', 10, 2 ); ?>
</body>
</html>
Developer | Cory Schadt |
Username | coryschadt |
Uploaded | October 19, 2022 |
Rating | 3 |
Size | 1,613 Kb |
Views | 18,216 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Pull TSX quote - jquery | 2,044 Kb |
MacBook Pro | 3,136 Kb |
Menu | 2,080 Kb |
FLEXY | 1,510 Kb |
Checkbox | 2,407 Kb |
Notifications | 5,304 Kb |
Jquery cycle2 youtube | 1,750 Kb |
Vertical Slick Slider | 3,545 Kb |
Wordpress - Force publish future event | 1,403 Kb |
FlexBox Mixin | 1,844 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
The CodePen Logo | Kindofone | 4,259 Kb |
Practice using Wixel | Emnk | 3,057 Kb |
Large canvas mousemove experiment | Jibbon | 2,885 Kb |
A Pen by Mohomed Anees | Mohomedanees | 12,597 Kb |
Portfolio Page | HuffmanJ25 | 5,240 Kb |
Custom Checkbox and radio inputs SCSS | Rgfx | 3,367 Kb |
Sony Xperia Z3 Flat MockUp | Dapinitial | 4,379 Kb |
Slider css only | Armandobau | 2,161 Kb |
Test | Dviate | 2,668 Kb |
Css3 slide | Nakome | 3,190 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!