Simply copy and paste the following code into your functions.php file or wherever your hold your shortcodes. This function will clean up the output of your shortcodes, which is especially important for nested shortcodes.
Although WordPress does make the process of embedding Youtube (among others) videos easy, it does not add a div around embed codes by default, so this is an essential step into making the video embeds responsive. Use the code below to add a wrapping div around each embedded video and also add the required CSS […]
Using the code below, you can add a video that will replace your featured image for the given product. If video is not found, the featured image is displayed instead. Place this code in your functions.php file and note that you may have to edit the function that displays the video to match your theme. […]
There are many times when you’re working on a custom WordPress website that you find yourself having to create several custom post types to improve the clients user experience. In most cases you find that some of these post types would make sense being grouped together under a single menu item. Not only does this […]
As mentioned on Magento forums the easiest way to achieve this is with overriding adminhtml config with your local custom one and activate it as module. This is just a small example of different approach with Admin Theme config option in admin panel, to show you how things can be done in different ways in […]
This is a great idea if you have clients who are creating their own posts. After you spend time devising an attractive template layout, clients often decide to skip the featured image, ruining the flow and presentation of what you’ve created. This snippet will require the author to select a featured image before the post […]
You can use the following snippet to add a 1% surcharge to your cart on checkout. You can easily change the $percentage variable to adjust the surcharge percent and you are good to go.
Ever needed to dynamically add/remove products to a visitor’s cart based on their cart contents? The below functions will help you do just that. Place them in the functions.php of your theme or (better) in a separate plugin and you are all set. Just make sure to modify the qualifies_for_incentive function to work based on […]
If you’ve been working with WordPress for a while, I’ll bet you’ve noticed the query string attached to each .js and .css file loaded by your site. (For those not familiar with query strings, they are all the jargon appended to your files when enqueued, for example &ver=1.1 or something siliar.) This happens because whenever […]
Depending on the script and what it does, you might want to defer them or load them asynchronously. Defered scripts are executed only after a page has finished loading completely, so if your script needs to be executed during page loads, an async attribute would be more appropriate. Keeping this in mind, the function below […]