Fix FOUC ‘flash of unstyled content’ on WordPress
FOUC aka ‘flash of unstyled content’ is a bit of a pain after a layout has been put together but does not load without that flash of odd content jumbled up on load. Using a snippet of jQuery by adding and later removing a CSS class of hidden to the html element but then showing…
Read MoreAdd a CSS class on a current active menu item
With manual menus you may need to add a CSS class to the current menu item that is active, below is a jQuery solution, that utilizes the URL of the page to match the link and add the CSS. (function($){ $(function() { // Document Ready activeMenu(); }); // Functions // @link https://stackoverflow.com/questions/4866284/jquery-add-class-active-on-menu function activeMenu() {…
Read MoreFixing BuddyPress Profile Page CSS on Beaver Builder Theme
When you look at a BuddyPress profile page on a full width page with no sidebar when using a WordPress default theme like Twenty Sixteen it looks a lot better than when viewing it in Beaver Builder theme… So out of the box the Beaver theme loses the navigation layout structure of…
Read MoreFill a whole Div element with a Link Tag inside the Div
You can fill a whole div or other parent element container in HTML with a link tag inside the div using some positioning attributes in CSS. The link tag is absolutely positioned to its parent which is relatively positioned, and will now fill the whole parent tag. You can either wrap the link tag around…
Read MoreCreate a Login/Logout Link in WordPress
To create a login/logout link in WordPress you can use a snippet of php code using the wp_logout_url function, you can also set the logout URL to be an external site to your own. <?php if (is_user_logged_in()) : ?> <a href=”<?php echo wp_logout_url(get_permalink()); ?>”>Logout</a> <?php else : ?> <a href=”<?php echo wp_login_url(get_permalink()); ?>”>Login</a> <?php endif;?>
Read MoreWooCommerce, Add Short or Long Description to Products on Shop Page
You can add a WooCommerce products’ long or short description to the actual product on the main shop page in WooCommerce via the woocommerce_after_shop_loop_item_title action hook, this hook places content immediately after the product title. Adding the Long Description to the Product Loop on the Shop page add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wc_add_long_description’ ); /** * WooCommerce, Add…
Read MoreChange Amount of WooCommerce Products Displayed on Shop Page
WooCommerce displays by default 4 columns and 10 products per page in the shop or archive page – the products per page is based off the amount of post set to display in the WP Admin Dashboard > Reading – Blog pages show at most setting. Here is how you can change the amount of products…
Read MoreRemove the Additional Information and Order Notes fields in WooCommerce
You can remove the Additional Information and Order Notes fields in WooCommerce checkout page with 2 filters that you add to your themes functions.php file The first filter woocommerce_enable_order_notes_field is returning false and will not display the ‘Additional Information’ heading and also the order notes field, I have found it needs to be run with a high…
Read MoreRemove Address Fields in WooCommerce Billing and Shipping in Form Checkout
WooCommerce has the ability to remove the address fields in the checkout form of the billing and shipping forms, this is great if you do not require the address fields as you may have a virtual/download only products that don’t require shipping, less fields to fill out = happy customers. You can remove address field…
Read MoreAdd Menu Items at the start or end or in a certain place with wp_nav_menu_filter
wp_nav_menu_filter allows you add items at the end of a menu in WordPress but what about adding an item at the start of a menu or in a specific place. add_filter( ‘wp_nav_menu_items’, ‘prefix_add_menu_item’, 10, 2 ); /** * Add Menu Item to end of menu */ function prefix_add_menu_item ( $items, $args ) { if( $args->theme_location…
Read More