Create An ACF Repeater Accordion in WordPress
Create An ACF Repeater Accordion for use in WordPress. Accordions can be a handy way of managing larger amounts of data to display only certain bits at a time. Create the ACF Repeater fields for the accordion. You can create as many accordion fields as needed, assign the field group to a post or…
Read MoreCreate A Responsive Bootstrap 4 Tab/Accordion ACF Repeater Loop
Create a Responsive Bootstrap 4 Tab/Accordion ACF Repeater Loop for use in WordPress. Bootstrap 4 Tabs stay as tabs in all viewport sizes which isn’t great responsively for larger content, however, this code has been adjusted to go from Bootstrap tabs to accordions at a certain breakpoint. (There is also another non-Bootstrap script that does…
Read MoreCreate an ACF Repeater Loop of Bootstrap Modals in WordPress
Create a while loop of Bootstrap Modals with an ACF Repeater field in WordPress. Create the ACF Repeater fields. You can create as many fields as needed, this example uses 3 basic fields, assign the field group to a post or page and populate the repeater rows. Add the ACF Loop Code View the…
Read MoreCreating a loop of Bootstrap Modals
To create a loop of Bootstrap style modals on a page, you can use a foreach or while loop in PHP. First, let’s do the code for one modal. Single Modal Code <!– Button to Open the Modal –> <button type=”button” class=”btn btn-primary” data-toggle=”modal” data-target=”#myModal”> Open modal </button> <!– The Modal –> <div class=”modal” id=”myModal”>…
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 MoreOutput Beaver Builder CPT Posts in a Module that belong to a Custom Taxonomy
Using Beaver Builder loop modules to output posts can be limited when you want to output a CPT that belongs to multiple custom Taxonomies but you only want posts to display from one taxonomy – this can be achieved in code using the fl_builder_loop_query_args filter. View the code on Gist. In the above code snippet…
Read MoreAdd Taxonomy Terms as CSS Classes to a Post
You can use the body_class filter in WordPress to add the Taxonomy Terms of a Custom Taxonomy as CSS classes to a post. The CSS class appears in the body element and is only used if the post has been assigned to the taxonomy. The code goes in your functions.php file. add_filter( ‘body_class’, ‘themeprefix_add_taxonomy_class’…
Read MoreAdd and Show Featured Images in Taxonomy Templates and in Single and Archive Posts
You can add a featured image to a Category Taxonomy in WordPress by using ACF and selecting the categories taxonomy, so now a new image field appears in the category back end page, the same process can be applied to other taxonomy templates such as custom taxonomies. Create a ACF Image Field for Taxonomy …
Read MoreDisplaying Featured Products in WooCommerce
WooCommerce has products called Featured Products which are products what become featured when they are starred in the WP Admin dashboard. Here is how you can display them. Featured Products Shortcode Display WooCommerce Featured Products via shortcode like so: Other parameters you can use in the shortcode are ‘orderby‘ and ‘order‘. Featured Products Custom…
Read More