How do I get WordPress URL rewrites into Sitemap?

Consider the two following custom post types: Museums Bakeries With one shared taxonomy: Region I’m using rewrite rules to improve the URL structure, so I can serve pages to visitors such as: https://myurl.com/museums/london (all museums in London) https://myurl.com/bakeries/birmingham (all bakeries in Birmingham) https://myurl.com/bakeries/london/aok_kitchen (a specific bakery in London) Here are the rewrite rules: function my_url_rewrite_rule() … Read more

Custom-post-type-archive: posts sorted/filtered by year?

I have a custom-post-type wr_event whose posts are sorted by meta_key “event_date”. Therefore I have this handy function … function get_event_list( $latest = true, $order=”ASC” ) { echo ‘<ul class=”event-items”>’; $yesterday = time() – 24*60*60; $compare = $latest ? ‘>’ : ‘<‘; $args = array( ‘post_type’ => ‘wr_event’, ‘posts_per_page’ => -1, // show all posts … Read more

WordPress custom post type archive with description

I have a common design pattern I’m not entirely sure how to best execute in WordPress. The layout is a listing of post teasers (title, trimmed body, image) on an overview page. Let’s say example.com is a boating safety company, and at example.com/classes there’s a listing of their posts of the class type using archive.php … Read more

Adding Sticky functionality to Custom Post Type Archives

In WordPress, Custom Post Types do not have Sticky functionality as a core feature. It is possible, I’m sure, to create it in certain cases—and I’m working on a project that requires it for archive-{customposttype}.php templates. I have downloaded and installed a plugin, called Sticky Custom Post Types, which I read in this article could … Read more

Custom query variable – get wordpress to redirect to nice permalink url

I have been looking for an answer for the last couple of hours but could not find anything pointing me in the right direction. Some advice would be very much appreciated! What I already have: A custom post type ‘stores’ A public query var using the ‘query_vars’ filter hook: ‘state’. Added the according rewrite rule: … Read more

How to remove current year from wp_get_archives

Does anyone know how to exclude the current year from $args = array( ‘limit’ => ”, ‘format’ => ‘html’, ‘before’ => ”, ‘after’ => ”, ‘show_post_count’ => false, ‘echo’ => -1, ‘order’ => ‘DESC’, ‘type’ => ‘yearly’, ‘paged’=>$paged, ‘post_type’ => ‘my_post_type’ ); wp_get_archives( $args ); This basically outputs all the years on my custom archive … Read more

Custom Post Type / Taxonomy Slug / Post Title with post type archive

I’ve tried plugins, read through stack and spent hours on this, and I just can’t seem to find a way to achieve what I want. I can achieve the following permalink structure: custom-post-type/taxonomy-term/post-title for example, our-work/interactive/some-project-title which also allows our-work/interactive to correctly display all our-work posts with the taxonomy term interactive, but I can no … Read more

Custom Post Type – Archive page title

I’m wondering if I could make a custom Page title for my Custom Post Type Archive page? Right now I’m using: <title><?php wp_title( ‘|’, true, ‘right’ ); ?></title> For my regular pages, it display what I want, but on my custom post type archive page it displays: Custom Post Type Name Archive Is it possible … Read more

How to redirect custom post type archive to first term of associated taxonomy?

I have a custom post type ‘countries’ and a taxonomy ‘cities’. My cities are: boston, new york… I want my archive-countries.php redirect to the first term taxonomy. I mean, if my URL is www.example.com/countries this should redirect to www.example.com/cities/boston. How can I do this? 1 Answer 1 If you know you’re loading the right template, … Read more