Category Archives: Web Development

WordPress multisite – switching blog by blogid and show content of specified blogid

Here is how you can show content from a wordpress multisite parent or another network site on a wordpress multisite network. Recently, I was tasked with a small task on a wordpress mutlisite network. The client wanted to show the primary menu from the main hq site on all of the network sites, and here is how I was able to implement that.

Read more

CSS based partial borders

While trying to accomplish a bracket like borders for a bootstrap design, there was a need to address the design requirement either using images or by CSS. While navigating through hundreds of designs and snippets online, I happened to cross a post by another developer titled for CSS based partial borders. Using the code from the developer, I was able to space the partial borders on left, top and bottom per design requirement.

Read more

Combine+Minify styles of parent theme and add as inline-style in wordpress

In a recent project, one of my tasks was to optimize and minify the styles included by the child-theme by combining and minify the styles of the parent theme into one file or include as custom inline style. While working on the task, I ended up reading multiple resources to and writing the function below. The function first fetches all the styles that are being included on page, and then for the handles belonging to the parent theme, the script then concatenates the scripts and then minifies by using preg_replace(). The generate combined CSS is stored in a database table and updated every 24 hours(triggered on page load). It then de-registers the style handles we have combined and includes the custom style as an inline style.

Read more

Check WooCommerce coupon via Ajax

Here is how a WooCommerce coupon code can be checked for validity. The code below allows us to check WooCommerce coupon against the database. This is done using the inbuilt WC_Coupon class provided by WooCommerce.

Read more

Smooth scrolling with location hash updation and location hash check on page load

Smooth scrolling with location hash updation and location hash check on page load

Read more