Category Archives: Code Snippets

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

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

WordPress user creation via custom PHP function

In the code below, we are registering the user via Ajax request and receiving a JSON reply from the script. The code also checks and validates the sent email address against the user information already in the database. You can place the code in your theme’s functions file and send the form via POST to admin-ajax.

Read more

Gravity Forms hook to ban a specific email address

On more than a few projects, I have ended up using Gravity Forms either because it was previously installed or was the need of the hour based on the requirements. Recently, I was asked to ban a certain email address due to frequent spamming by the email address in concern. I am aware of the fact that the spammer can change email address and continue spamming. My task was simple, just ban the email address.

Here is how I chose to complete the task

Read more