Wordpress customization

Handle pagination in wordpress custom php code

In case you are writing wordpress custom code and need to show lot of content, it may be a good idea to support pagination. The read more

How to and why disable wordpress cron

WordPress crons are different from traditional Linux or Windows crons. Traditional cron runs as independent processes at regular interval. WordPress crons are php hooks which read more

How to customize wordpress image alt tag

In case you want to beautify image alt tag for all your wordpress posts, you can use filter hook the_content. Attach a filter function to read more

How to display date in wordpress pages

The default Twenty Twelve theme which comes with wordpress and many other themes display creation date in wordpress posts but do not display any date read more

How to display wordpress page list with specific custom field value

WordPress lets you display a list of pages as links with many customizations. You can use wp_list_pages or get_pages to display or get list of pages. read more

How to display wordpress top level pages

Displaying wordpress top level pages may be useful for displaying sitemap or browse interface on a wordpress site. Here is the code you can use read more

How to hide a post from home and RSS feed in wordpress

Sometime we want to hide a post from wordpress home page. One not-so-good alternative is to create it as a page. One drawback of that read more

How to include bootstrap javascript and css in wordpress post

Bootstrap is pretty handy javascript and css library/layer over jquery which provides many useful pre-built functionalities like responsive design, transitions, modals, buttons, etc. In case read more

How to include wordpress pages in archives

WordPress archives are very useful in providing users and search engine bots like Googlebot a great way to browse all content on a wordpress site. read more

How to override priority and change frequency in Yoast xml sitemap

It is important to maintain healthy xml sitemap for your site. In case you are using Yoast SEO plugin to generate xml sitemap for a read more

How to remove xmlrpc from wordpress headers

If you don’t need xmlrpc in your wordpress, you can disable it at various places like http x-pingback header, html meta tags, etc. Here are read more

How to setup wordpress custom query params with pretty url format

WordPress pages can handle query parameters in url in the traditional format of “key=value”. e.g. If you want to create a page to display details read more

How to show wordpress pages on front page with skip_home custom field

By default WordPress pages donot show up on home page. Only posts are displayed on home page. Here is wordpress php code which can be read more

How to use google custom search for wordpress site

WordPress comes with a default search which searches posts and pages from your site. It works pretty decent. Here is why you should consider switching read more

How to write custom php in wordpress

If you are just writing text articles then you never need to write any custom php in wordpress. In case you want to write dynamic read more

No frills social share links for WordPress sites

There are many plugins available for WordPress which lets visitors share the post or current page on various social networking sites like Google Plus, Facebook, read more

Using WordPress custom field for displaying code

WordPress custom fields (post meta keys) can be used to store key value pairs for a post. This can be very useful to store code read more

WordPress – add content filter after shortcode execution

Sometimes we need to add content filter in wordpress which should execute after all the shortcodes. The shortcodes in wordpress are executed by filter do_shortcode read more

WordPress – customize category and tag links

In case you need to create a custom link for category or tag, the you can term_link filter. This can be useful in case you read more

WordPress – customize facebook plugin opengraph meta tags

If you are using facebook plugin in workdpress, it adds opengraph meta tags in wordpress posts. At times we want to remove or customize some read more

WordPress – customize posts per page for tag, category and date archive pages

The following code can be used to have separate value of posts per page for various archive pages (category, tag, date, author, etc.)

WordPress – exclude specific posts from archive pages

Sometime we need to exclude specic posts and pages from wordpress archive pages. If there are some internal pages behind auth, you may want to read more

WordPress – get posts/pages with missing meta key

Get post_type page with missing meta_key Get post_type post with missing meta_key

WordPress – how to add filter to description meta tag

If you using Yoast seo plugin, then you can use its filter wpseo_metadesc to change meta description tag as per your needs. Typically you want read more

WordPress – how to create custom tag cloud

WordPress has support for displaying tag cloud using wp_tag_cloud. It displays tag cloud and has support for including and excluding tags and specifying mininum and read more

WordPress – how to exclude specific tag posts from a tag archive page

WordPress will display all posts on a tag archive page which are tagged with that tag. Sometimes we want to exclude posts of more specific read more

WordPress – write custom php log to separate file

Why write php log to separate file Using default php error log in wordpress php code for informational messages can pollute php error log file. read more

WordPress how to check if a post is being viewed by admin

In WordPress you may want to do certain things only when admin user is viewing a post. Here is quick code snippet to know if read more