Create A Responsive Bootstrap 4 Tab/Accordion ACF Repeater Loop

Boostrap Acf Repeater Tabs

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 More

Create an ACF Repeater Loop of Bootstrap Modals in WordPress

Foreach Loop Bootsrap Modals

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 More

Creating a loop of Bootstrap Modals

Foreach Loop Bootsrap 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 More

Conditional Check if Custom Post Type Posts Are Published

Check Cpt Loop Conditionally

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 More

Output Beaver Builder CPT Posts in a Module that belong to a Custom Taxonomy

Beaver Builder 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 More

Add Taxonomy Terms as CSS Classes to a Post

add-tax-terms-css-posts

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 More

Add and Show Featured Images in Taxonomy Templates and in Single and Archive Posts

show-category-image-on-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 More

Displaying Featured Products in WooCommerce

woocommerce-featured-products

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