Tag: Snippets

Shortcode to display content for Mobile or Desktop visitors only

Did you know that WordPress has a mobile detect function already. In this post we will show you how you can use wp_is_mobile function to create a simple shortcode to hide certain parts of your posts from mobile visitors or the other way.

HowTo: Replace WordPress self hosted jQuery with Google jQuery

If your hosting server is not fast enough, you may want to replace your self-hosted #jquery with google cdn hosted jquery. You may think that you are not using that script anyways, but most of your #plugins do.

HowTo: Change number of posts displayed on Search

WordPress usually use a constant number of posts for all your category pages, index, and also search results pages. For search pages, 10 posts are not usually enough. To change this behaviour, a simple query filter will do the trick.

Popular web design font stacks, revisited

We all have some favorite fonts, but when it comes to cross-platform design, we have to choose our fonts families carefully. So I made a huge list of font stacks that suit really good. Make sure you add this list to your favorites.

How to use default WordPress RSS widget in your php templates

I showed you how to use widgets using the_widget in your php templates before. Upon request, I am going to show you how to use WordPress RSS Widget with the help of WordPress the_widget function.

Displaying random posts using shortcode

Random posts can be a great opportunity to generate hits for older content. Especially for gaming and portfolio sites this snippet will be great use. Here is how to set it up for your theme.

How to get page id using page slugs in wordpress

One of my visitors asked me how to get page id using page slug and i wrote a small snippet to easily achieve this in a simple loop. Follow read more link to see the snippet.

How to display a “Back to parent” link on your blog pages

For a better seo, and a better user experience, you can easily add a “Back to parent” link on your pages. In this post i will show you how to add it to your page templates.

How to list files in a directory using PHP

Using this simple snippet, you can easily get files in a directory as an array. It even allows file type filters.

How to display latest tweet on your site

To display your latest tweet on your site just add the following function in your functions.php file.

Adding countdown to your theme using php

For theme designers sometimes #php is better than #shortcodes. So here i will show you how to easily add countdown widget to your theme file. You need to know some php to integrate it with your posts.