Custom Post Type/ Taxonomy URL rewrite
Open Settings > Permalinks and just click on the Save Settings button without any changes.
Open Settings > Permalinks and just click on the Save Settings button without any changes.
To update properties of a post in the database use wp_update_post. // Update post 37 $my_post = array( ‘ID’ => 37, ‘post_title’ => ‘This is the post title.’, ‘post_content’ => ‘This is the updated content.’, ); // Update the post into the database wp_update_post( $my_post ); Just beware of the possibility of an infinite loop … Read more
There are template filters for all types of queries. You could use archive_template in this case. function wpd210689_template_filter( $archive_template ) { $post_types = array( ‘america’, ‘china’, ‘nepal’, ‘norway’, ‘chile’ ); if ( is_post_type_archive ( $post_types ) ) { $archive_template = locate_template( ‘archive-country.php’ ); } return $archive_template; } add_filter( ‘archive_template’, ‘wpd210689_template_filter’ ) ;
I didn’t really solve it, but got around with the help of Passing custom args in paginate_links and Custom paging function. Initially I even thought of writing a patch to next_posts_link, but as it turns out, the URL formatting problem lies way below in the function soup, and that is really a downer when all … Read more
To find projects happening within a range of dates, there are 3 cases you have to account for: A project starts within the range A project ends within the range A project starts before the range and ends after the range You can test for these 3 cases separately with an OR meta query and … Read more
You don’t need to make them separate queries. Query for all 12 posts, when you output them in the first section only output them if $wp_query->current_post < 6, then rewind_posts() and run the loop again, only outputting them in the second section if $wp_query->current_post > 5. If you are using a custom WP_Query, swap $wp_query … Read more
The problem in this case is the name of the post type, action. WordPress core uses the query var action for its own purposes, so this has created a conflict somewhere within the code. The solution is to rename the post type to something unique to remove the conflict.
My first guess would be that he needs to make sure the checkbox is checked for that particular CPT under Screen Options (top right of Appearance -> Menus).
The way you are customizing the query you are telling it to search for posts that ALSO match a custom tax_query criteria. This would never work, logically speaking. You said, “I want it to return a result if this tag is searched or if it matches the title” for which I understand ONE or ANOTHER. … Read more
Assuming this to be the primary question: How would i fill the “empty” years with li elements and add classes depending on years? You don’t really have a “query” problem, just a PHP/markup one. You need to track you years independently of your query. Below is proof-of-concept code for doing that. I did not try … Read more