WooCommerce Conditional Tags

All conditional tags test whether a condition is met, and then return either TRUE or FALSE. WooCommerce page is_woocommerce() Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included). Main shop page is_shop() Returns true when on the product archive page (shop). Product category page … Continued

Linking to JSON data from dist folder

One of the problems I came across recently whilst using Webpack was the fact that once yarn build -p had been run all the assets are given hashed filenames, such as: data.8687234d3.json But the JavaScript I had written was looking for and trying to load data from data.json. Webpack takes care of all the typical … Continued

WordPress setup_postdata()

You must use $post and global $post. global $post; $args = array( ‘numberposts’ => 5, ‘offset’=> 1, ‘category’ => 1 ); $myposts = get_posts( $args ); foreach( $myposts as $post ){ setup_postdata($post); echo the_title(); } wp_reset_postdata();

Velvet Blues Update URLs

If you move your WordPress website to a new domain name, you will find that internal links to pages and references to images are not updated. Instead, these links and references will point to your old domain name. This plugin fixes that problem by helping you change old urls and links in your website. Features: … Continued

Noindex,follow always added to head

I came across a scenario when I was debugging a website recently in that the header contained the Noindex,follow tag no matter what optiosn were selected in the WordPress admin area. This is because of Disallow indexing plugin included. It’s a must use plugin that get’s installed when you install bedrock. If you change the environment … Continued

Writing Code in Your WordPress Posts

To set your code aside so that it looks like a box of code which may be copied and pasted within other code or template file, you can use the <pre> HTML tag. The <pre> tag instructs the browser to use a monospaced font, but to exactly reproduce whatever is inside of the <pre> tags. Every space, line break, every bit of code … Continued

ACF Pro Composer Install

When installing Advanced Custom Fields (ACF) Pro via composer I was getting the following error: “The requested package advanced-custom-fields/advanced-custom-fields-pro could not be found in any version, there may be a typo in the package name.” To resolve this I had to add a custom repository to my composer.json file in the repositories section: { “type”: … Continued

Sage theme install

Installing Sage Based on our previous article How to install Bedrock, a WordPress boilerplate you will have a WordPress site up an running. We will now be building our template to control the layout of our site. # Change directory to our themes folder $ cd /var/www/example.co.uk/public_html/bedrock/web/app/themes/ Install Sage using Composer from your WordPress themes directory … Continued

How to install Bedrock, a WordPress boilerplate

What is Bedrock? Developed by https://roots.io/, Bedrock is a WordPress boilerplate used to help organize your WordPress project, structure configuration files, and manage plugins with Composer. Working as part of a team it has enabled us to maintain a standard structure for all our newly deployed WordPress sites. The organization of Bedrock is similar to … Continued