Tag Info

New answers tagged

0

Custom post type archives don't have year/month rewrite rules, they only have a single archive which will be at /press/ and /more_posts/. If you want those, you'll have to add them yourself. For the taxonomy, add the taxonomies argument to your post type registration to insure the two objects are connected, see the note about this on register_post_type.


2

You can extend the get_the_archive_title filter which I've mentioned in this answer add_filter( 'get_the_archive_title', function ($title) { if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { ...


3

Welcome to WPSE Ittikorn! Sometimes it is the easiest to just look right at the source. There even is a link right at the bottom of the Codex page you linked: https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/link-template.php#L1112 There you can easily see that there actually is a filter called post_type_archive_link So to give you an ...


3

Just look at the source of get_post_type_archive_link(): return apply_filters( 'post_type_archive_link', $link, $post_type ); Sidenote: The function uses home_url(), which is a wrapper for get_home_url(), which offers another filter: return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); that runs earlier. With "pretty permalinks" ...


2

The filter is post_type_archive_link, defined (WP 4.1.1) on line 1112 of file wp-includes/link-template.php: apply_filters( 'post_type_archive_link', $link, $post_type ); And the use: add_filter( 'post_type_archive_link', function( $link, $post_type ) { //Do something return $link; }, 10, 2 );


2

The Easy Way This is by far and away the easiest approach to this, but unless you are willing to be a little bit flexible with how you present your archive it's not for you. The easy solution is achieved using the wp_get_archives() function. Unfortunately though there is no filter available to manipulate the output, so you'll be left with a list like this. ...


0

You would place this code inside your theme's functions.php file. It shouldn't really matter where in the file that you place it.


2

Before I start again, I just want to reinforce the fact you should not run a custom query in place of the main query on your archive pages. Please see this post to learn when you should use a custom query and where not. I you do not switch back to the default loop, then my solution will not work In the previous post we have already solved the issue to only ...



Top 50 recent answers are included