On the month archive page (using the date.php template), how can I add links for the previous month and next month? For example, viewing January 2022 (/2022/01), I'd like a link to December 2021 (/2021/12) and a link to February 2022 (/2022/02).
I have a custom post type set up (two, actually) that are not displaying properly. I am hoping that it is the same issue with both post types. Here is my code for one of the post types (portfolio). The second is quite similar. <?php add_action('init', 'ccd_portfolio'); function ccd_portfolio() { $labels = array( 'name' => _x('Portfolio', 'post type general name'), 'singular_name' => _x('Project', 'post type singular name'), 'add_new' => _x('Add New', 'ccd_portfolio item'), 'add_new_item' => __('Add New Project'), 'edit_item' => …
I would like to change archives.php post listing as follows. Whenever clicked on certain link in archives select drop down box, archive page should list posts from May - Dec of that year, plus Jan - April of next year. Eg. If i clicked on archives drop down, 2015...Archives page http://domainname.xyz/2015/ will list all posts from the database starting from May 2015 to December 2015, also January 2016 to April 2016. This is to display posts in an annual year …
I'm having a hard time using this snippet I'm getting double views each time the post is queried. This is in my functions.php file: function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0"; } return $count; } function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } // Remove issues with prefetching adding extra …
I have a custom post type of "show" and within that custom post type I have set up a taxonomy / category called "venue" which has two options "venue-one" and "venue-two" (slugs). On the two archive pages I have set up, where each shows all posts from "venue-one" or "venue-two", pagination is not working past page 3. I am using numbered pagination and visually it does display what the correct number of pages should be (given what I set posts …
I have custom post type like this register_post_type( 'workforce_archive', array( 'labels' => array( 'name' => __( 'Workforce Archives' ), 'singular_name' => __( 'Workforce Archive' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'workforce_archive'), 'show_in_rest' => true, 'show_in_menu' => false, 'supports' => [ 'title', 'editor', 'author' ] ) ); And also have a file archive-workforce_archives.php but still I am getting 404 page when visit this URL "http://taliestrategies.local/workforce_archives". Any help is appreciated. Thanks
I've looked over numerous questions and answers on problems somewhat related to this but can't seem to find the same situation or solution. I have a custom taxonomy that needs to have an archive page that can display both custom post types and regular posts, but not in the same section. Basically there needs to be a clear difference between the CPT-posts and regular posts. For example, if "movie guides" is the custom taxonomy, "ben affleck" is a movie guide, …
Exploring WordPress and bumped into this issue: In my theme root page-templates/home.php which is a common page template used in multiple pages. Now I want to include the same template (with some minor query parameters changed) in my archive/category page. I know I can just copy and paste the whole home.php template to a category.php. But It feels like there is a better way to do it. [my home page showing the latest article at the top, 3 popular articles …
I have a Custom Post Type: "Sponsors" Sponsors have a Custom Taxonomy: "Sponsor Ranks" Sponsor Ranks are divided like Platinum Sponsors - Gold Sponsors - Silver Sponsors and so on I want to make an archive page that will show me all sponsors within their respected rank Currently I have something that works perfectly fine but I am unsure if this is the right way. I am basically making a new query every time, that doesn't feel right. <div class="row"> …
Background: I have a hierarchical taxonomy and I'm trying to create a taxonomy template file that lists each of the child terms with the associated posts below each. So far I have managed to achieve most of this, but I have come across a rather strange situation which I am hoping someone might have an answer for. What I doing is taking the queried term and getting the child terms for that parent. It then loops through the terms and …
So I basically need to overwrite my category template in my child theme with the one in my plugin but I can't seem to get it working. I have checked the files paths and everything and there all correct this seems to be the way of doing it but again Wordpress doesn't seem to be using the template from my plugin. add_filter( 'taxonomy_template', 'load_new_custom_tax_template'); function load_new_custom_tax_template ($tax_template) { if (is_category()) { $tax_template = dirname( __FILE__ ) . '/category.php'; } return …
I have index.php and archive.php in my theme, but I'd like to using archive.php to display blog and category posts. Is it possible to override index.php by archive.php?
This topic has many similar posts, but I'm not finding one that addresses my issue precisely. Here is what I have done so far: I added a Custom Post Type to functions.php. This works. The imported posts show in the dashboard. I created a custom query to create a category page. This works, I can make it show a few or all of the records, but there are about a hundred posts in this category, so I need pagination. The …
I am trying to use isotope filtering (cool animations) with bootstrap tabs where each tab-pane has its own custom post-type query loop. For some reason, I have to click twice on the tabs to have the fitRows layout work. I use get_post_type() to get the post type for the data-category attribute in the content-archive.php file. I have tried and/or implemented the list below. wrapped with on load function set max width and height for images imagesLoaded and layout (formerly isotope …
I created a CPT with slug plist via cutom plugin I made. In my local host the archive work but in live server it return blank page. Here is the 'include' archive page code /** * Add Price List archive template * @since 1.0.0 */ add_filter( 'archive_template', 'get_plist_archive_template' ) ; function get_plist_archive_template( $archive_template ) { global $post; if ( is_post_type_archive ( 'plist' ) ) { $archive_template = dirname( __FILE__ ) . '\partials\archive-plist.php'; } return $archive_template; } Link: http://cratetimer.com/plist/ Also this …
Many custom post types have their own archive page which doesn't exist in the page list, but I am able to customize these pages by finding the archive's template file. But for some other instances, I couldn't find such template files. For example, Buddyboss's register page such as this one:https://fedlearningcenter.com/register/ By default, there isn't a nav bar on the page. How do I find the corresponding file or filter so I can add a nav bar to the page? I …
I am working on my new WP Plugin for advanced control of custom post types and meta boxes. Actually, I am working on an HTML Builder for the full customization of single and archive templates for the registered CPT. I am struggling now with this problem: how to integrate these new templates into any Wordpress theme? I found this: Dynamically override page.php or single.php with custom templates using function It fits my needs indeed but since every Wordpress theme is …
I am using wp_get_archive() in category.php. If I am on page of category=2 it should show my archives of only that category. However it is for all the categories. Following is the code for my category.php as well as archive.php <?php get_header(); ?> <?php $args =array( 'posts_per_page' =>1, ); $loop = new WP_Query( $args ); if($loop->have_posts()):while ( $loop->have_posts() ): $loop->the_post(); the_content(); endwhile; endif; ?> <?php wp_get_archives( array( 'type' => 'daily') ); ?> First part that is to show archive of …