wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Show or Hide widgets on specific pages

wordpress snippet

Want to show or hide widgets on specific pages? This is a great little snippet contributed by Joel Worsham that will do just that. You will first need to get the id name of the widget that you wish to define. You can do this be viewing the page source or using a web inspector tool to view the widget id. The current sample is setup to only display the core ‘pages’ widget on the contact page only. Don’t forget that is_page also accepts an array of page names and id’s.

read more

Dynamically create and attach sidebars to pages or posts

wordpress snippet

This is a bit large for the snippets I normally post however very useful. This snippet will let you easily create new sidebars by simply adding the name to an array. You will also be able to define the dynamically created sidebar a page loads by selecting from the custom sidebar selection metabox.

read more

Replace widget title with custom title and HTML

wordpress snippet

Adding this snippet to the functions.php will let you use a filter to replace the widget title with custom title and or html.

read more

Disable sidebar widgets on specific posts

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will let you disable widgets on specific posts by updating the array on line 3 with post ID’s. Please note that this is a comma separated list of ID’s.

read more

Create most recent posts dashboard widget

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will create a new dashboard widget showing the five most recent posts.

read more

Remove recent comments wp_head CSS

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will remove the CSS added to the header for the recent comments widget.

read more