Change Number of Posts Displaying on a Custom Post Type (CPT) Archive Page
To change the number of posts that appear in an archive page for a custom post type you can change the number using the pre_get_posts action with some passed in parameters. Normally the number of posts displayed per page is defaulted to the setting in the Dashboard Reading Settings > Blog pages show at most –…
Read MoreRedirect a Custom Post Type’s Single and Archive Pages in WordPress
You may find that you need to hide or redirect a custom post types single or archive pages or even both in WordPress. This may be the case if you are outputting a custom loop of CPTs and don’t want duplicate content or discoverable pages which you don’t want published. In the above gist in…
Read MoreConditional Check if Custom Post Type Posts Are Published
You can check on the existence of published Custom Post Types by using a new WP_Query loop with an if/else statement, as the CPT is already registered it is difficult to use a conditional check without checking the loop of posts. add_filter(‘wp_nav_menu_primary-menu_items’, ‘wpb_add_menu_item’, 10, 2); // Add to primary menu based on CPT existence function…
Read MoreFilter CPT Archive by Custom Taxonomy with Isotope
The Isotope JS library allows for some instant filtering of posts from a taxonomy without page reloading. Below is a template file which uses a CPT Archive page and a Custom Taxonomy called ‘my_category‘. Since it’s a CPT Archive page it uses WordPress native loop, there is some specific CSS class markup for the posts…
Read MoreCreate Multiple Marker Map from ACF Google Map Location Field from a CPT
Here is a rundown on how to get a multiple marker Google map on a page that contains markers for a business dealer that has it’s own Custom Post Type (CPT). Each dealer has it’s own CPT with an individual map location marker and also another agnostic page that has all the dealers map markers in a…
Read MoreFilter Custom Post Types by Taxonomy in WP Admin Dashboard
Filter CPTs by a linked custom Taxonomy in the WP Admin Dashboard is possible with restrict_manage_posts. In the screenshot there is a CPT list of posts, with a dropdown menu of a linked custom taxonomy terms which are filterable via the filter button next to it. The code goes in functions.php View the code on…
Read MoreAdd Search & Filter Pro to Beaver Themer Post Module CPT Archive
You can use Search and Filter Pro with Beaver Builders Themer Post Module columns post layout, this guide goes through the tweaks needed and uses a CPT (custom post type) archive page. Create your Posts Module CPT Archive Page via Themer Create your Posts Module with the columns layout on a CPT…
Read MoreShow related posts in Beaver Builder from one CPT to another with ACF Relationships
Showing related posts in Beaver Builder from one Custom Post Type to another is possible with an ACF Relationship field and Beaver Themers Post Module and relationship field connector from version 1.1.1. You can also use the Post Slider and Post Carousel Modules. This tutorial uses 2 CPTs, ‘Lights’ and ‘Projects’, the intent is to…
Read MoreShow related posts from one CPT to another with ACF Relationships
Showing related posts from one Custom Post Type to another is possible with an ACF Relationship field. This tutorial uses 2 CPTs, ‘Lights’ and ‘Projects’, the intent is to show the ‘Lights’ used in each ‘Project’ so the reader can click the link back to see the light from a project CPT. (This is also…
Read MoreChange the WordPress Post Type name to Something Else
You can change the default Post type name in WordPress from Posts to something else like News using the get_post_type_object, normal behaviour of the Posts occur, just the label name in the WordPress dashboard has been changed. add_action( ‘init’, ‘cp_change_post_object’ ); // Change dashboard Posts to News function cp_change_post_object() { $get_post_type = get_post_type_object(‘post’); $labels =…
Read More