Category : Quick Tips

Check If WooCommerce Plugin is activated or not?

For WordPress plugin developers, it’s a very common practice to check if depended/required plugin has been activated or not before executing their own plugin code. Yesterday, working on few updates of FAQ Tab For WooCommerce – Advanced FAQ Addon. Then added following lines of code to check if WooCommerce plugin already installed and activated in my site or not. If [...]

How to display WordPress shortcodes as a text?

Last day working on a documentation of my BWL Advanced FAQ Manager Plugin and I need to display FAQ shortcodes as text inside of documentation. I’ve pasted shortcode inside the documentation page and when it display in front-end shortcode executed and display it’s contents. That gives me a lot of pain. There is a small trick to display shortcode as [...]

How to create a triangle using CSS3

Today we are going to learn about how to create a triangle using CSS3. First of all it’s very simple to do, but required a to know a tip. We will use border-radius property to create that triangle. I’ve also added download and demo link just below the post. So you can check and download source code for future use. [...]

How to Generate Random String in JavaScript

Generating random string in JavaScript is extremely simple. Last day, I worked on my freelance project and I need to create a long random string using JavaScript. As I said before, it’s simple but bit tricky. I thought I can share that snippets, so that you can use that code in your project too. So let’s get started – – [...]

How to remove character from a string?

Removing characters from a string is most common and frequent activities in PHP. Suppose, You have a long name, but your system does not allow to show more than 6 characters of your name. In this case, you need to keep only first 6 characters from your name. To solve this issue we use substr() function. – Solution to remove [...]

PHP function to extract components from an URL

You want to extract the protocol, domain name, path, or other significant component of a URL. Use the parse_url() function to automatically split the URL into its constituent parts. The parse_url() function is one of most useful URL manipulation function in PHP. Ita takes a parameter of a Uniform Resource Locator (URL), and splitting it into its individual components. The [...]

How to get header footer and sidebar in wordpress

Hello friends, today I’m going to share 3 basic WordPress function about how to load header, footer and sidebar in your WordPress theme. Each WordPress theme contain 3 common files for header(header.php), footer(footer.php) and sidebar(sidebar.php). To load that files WordPress have 3 dedicated functions. Here they go- – Load header: Header section contains basic elements like logo, top menu, main [...]

How to use loop in wordpress

Today we are going to learn how to use loop in WordPress. Well, “loop” is a very common term in WordPress. Because we need to use this “loop” for load posts and comments. Here goes a loop structure in WordPress. Have a  look-   if(have_posts(): while(have_posts()): the_post(); echo "Your post contain goes in here"; endwhile; else: echo "You have no post [...]

How to check empty string values in PHP?

As a PHP programmer most of the time you have to deal with form submission. In a form submission page, user may be submit a form without filling all required fields like user name, valid user email address or passwords. In that situation your system must show a notification message that, “user name field” is required. In another case, sometimes [...]

How to redirect mobile devices using htaccess

It’s a very simple tricks to redirect visitors in your mobile supported website. This simple htaccess snippet can detect browser agent and redirect it to your mobile website if they come from any mobile/table device. Have a fun with this script. Enjoy!   RewriteEngine On RewriteCond %{REQUEST_URI} !^/m/.*$ RewriteCond %{HTTP_ACCEPT} "text/vnd.wap.wml|application/vnd.wap.xhtml+xml" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-" [NC,OR] RewriteCond %{HTTP_USER_AGENT} "dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-" [NC,OR] [...]