WordPress WP_Query: Get Posts by Meta Values

As you know all the posts have the metadata you can fill in “Custom fields” metabox (it can also be hidden). So, for example, if you want to get a post with meta key show_in_slider and meta value true, you can do it in the following way: Otherwise, if you need to query all posts […]

How to Integrate responsive-nav.js into WordPress Navigation

Responsive Web Design is all the rage these days. Clients are asking for it, web developers are expected to know it, and most importantly, mobile devices are more popular than ever. One big area of a website is website navigation. In my post, I talk all about responsive navigation and how to make it work […]

Taking Control of WordPress 3.8 Admin Bar

What is WordPress Admin Bar? WordPress admin bar was introduced in WordPress 3.1. The purpose of the WordPress Admin Bar was to connect the backend (dashboard) of a WordPress to the Live. It always shows up right below the browser address bar and looks somewhat like below image: The WordPress Admin Bar helps webmasters switch […]

How to Control WordPress Custom Post Types, Capabilities and Roles

As We all knows about Custom Post Types and how to create them, when we create custom post types without Capabilities all users except subscriber roles can publish, read, edit and delete them by default. What if we wanted to create a custom post type that Author could read, edit and publish but Author Staff […]

Notify WordPress users of newly published post

So you have a post section and each time you publish a new custom post you’d like to notify all your users (subscriber). It could be a post, a product, an event or perhaps a tutorial etc. Usually the action hook would be ‘publish_post’ or ‘publish_page’ but those hooks only work for Posts and Pages. […]

How to create a new WordPress array ?

So you have a set of data stored in an array and you want to put aside or create a new array with certain data. There is a powerful function called wp_list_pluck() and wp_list_filter() that can be used for such tasks with any sort of datasets. For example consider the following array: First of all […]

Improve loading, Remove unnecessary scripts and styles in WordPress

Some of the plugins, when installed, add 2 or 3 scripts and stylesheets to every page on website. This isn’t necessarily a problem but it would be nice to have scripts loaded only on pages that actually need them. Let’s take a example of the most popular Contact Form 7 plugin. Most likely, only pages […]

Show Custom Post Types on the Homepage

Custom post types are commonly used in WordPress sites, but they don’t show on the homepage or in the archive pages unless you write code to do that. I’ve put together some code that is smart about detecting your public custom post types and automatically adding them to your homepage and archive pages:

How to add custom fields to your WordPress edit screens

We have too many way to create fields in wordpress admin edit screen. But i always prefer plugins. So today i going to introduces with a Best Custom fields Creation plugin. The plugin name is “Custom Field Suite”. Please check bellow link for plugin details: Plugin author link https://uproot.us/ Plugin Document link https://uproot.us/projects/cfs/documentation/

How to track Post Hits by Using WordPress Post Meta without plugin.

This is a small trick, any one can use this trick in wordpress theme. Just open your wordpress thme function file “function.php”. And put bellow functions into your function file. The above functions’ will create a custom field called ‘post_views_count’ attached to the ID of a post that will record the data but, if we […]