Tag archive for: functions.php

How to allow arbitrary Widget content to be added to sections of your WordPress theme

When you use WordPress to house your thoughts, you get the flexibility to update sections of your WordPress site through the WordPress dashboard.

For example, I can change the content within the sticky portion of my sidebar as and when I need to. Such content can be provided through the various WordPress Widgets that are available in my WordPress installation.

So how can we mark sections of our WordPress themes for displaying Widget content?

With this in mind, let us look at how we can allow arbitrary Widget content to be added to sections of our WordPress theme via the WordPress dashboard.

How to reflect cart count at the cart icon as and when products are added or removed from the cart in WooCommerce

Although there is a hassle free option of using WooCommerce.com as your e-commerce store, you may prefer to host your own.

If you are familiar with WordPress and wish to host your e-commerce website, WooCommerce is also available as a WordPress plugin that augments WordPress with e-commerce website features.

Although more work needs to be done for self-hosted WordPress sites, we have the option of creating our own themes without having to pay additional charges on top of the web hosting fees.

When it comes to creating our own WooCommerce themes, one feature that we may want to implement would be to show the number of products that had been added to our WooCommerce cart near the shopping cart icon as and when products are added or removed from the cart.

This post documents how we can reflect cart count at the cart icon as and when products are added or removed from the WooCommerce shopping cart.