Tag Archives: Hints ‘n’ Tips

Browse through here to find nuggets of good practise and quick solutions to tricky problemtito.

db

WordPress Database Functions

The WordPress database class is quite extensive and provides a range of methods to work effectively with the database and thereby use the WordPress standard. You can find the class in /wp-includes/wp-db.php where the individual methods are documented. I show the most important ones and give some small examples. It is important to work with […]

wp-security

Security Advice for your WordPress Installation

WordPress enjoys great popularity and draw more attention of people who want to gain unauthorized access. As with any open-source software developers and attackers alike can view the code. The risk of spam links, the destruction of the blog and other attacks is therefore very high. But this article shows the possibilities to secure WordPress […]

wordpress-code-small

Use WordPress Cron

WordPress has its own cron to automatically and scheduled run certain themes. Therefore WordPress provides several functions to use the cron. In our first example we send every hour a mail with the help of the WordPress function wp_mail(). FYI, this is just a possibility, please don’t do it on your system! As default, WordPress […]

baby-wallpaper42

Understand WordPress Child Theme

With version 3.0 of WordPress, the much anticipated feature of Child Themes was integrated or some might say it was improved, since it was actually possible to use it. I like to show you an example based on the new default Theme TwentyTen how you use it. Another example can be found in my WP […]

ozhwpe1

Adding Settings to an Existing Page Using the Settings API

When it comes to saving options and settings in WordPress, you all probably know and use the Options API: add_option(), update_option(), get_option() and delete_option(). These functions are the first layer of another, broader and powerful, yet under-used, API: the Settings API. Goal of this Tutorial Some time ago I wrote a quick tutorial on how […]

custom-admin-bar-300x71

Add Menus to the Admin Bar of WordPress

The new WordPress admin bar facilitates the access of backend and frontend to areas of the back end. Of course, this new control element of WordPress is expandable and can be adapted to the needs of the user. In some areas and for various needs, quick access to different areas is certainly interesting. The newly […]

default-wpe

Comment Form Hooks Visualized

Most themes (e.g. TwentyTen) use the comment_form() function to insert the comment form after posts. There are quite some hooks inside the function but they are hard to localize. The codex documentation isn’t too helpful, neither. To give you an easy overview the following diagrams visualize the points where the various hooks are anchored. The […]

wordpress-code-small

Remove Menu Item in WordPress Admin Panel

With WordPress Version 3.1 two new functions were added which makes it easier to remove menu- and submenu-entries in WordPress Admin Panel. These functions removing entries of the menu-tree remove_menu_page or submenus – remove_submenu_page. /** * Remove a top level admin menu * * @param string $menu_slug The slug of the menu * @return array|bool […]

wordpress-code-small

Predefined callback functions for filters

Filters are often used for removing content. For example, if you want to hide the admin bar you can do the following: function hide_admin_bar() { return FALSE; } add_filter( ‘show_admin_bar’ , ‘hide_admin_bar’ ); It’s a bit tedious to define an additional function just to return “FALSE“. Since version 3.0 WordPress provides various functions to shorten […]

wordpress-adminbar-icon

Add Icon to Site Link in the WordPress Admin Bar

Each button in the Admin bar has a self-defining and space-saving icon. But the link to the blog frontend (which is represented as a blog title), has no icon. If you want, you can change it quickly – here is a small solution. The following code belongs in the functions.php of the Theme, or better, […]

21-03-2012-13-23-07

WP_List_Table – a step by step guide

Throughout WordPress the class WP_List_Table is used to display data, e.g. users, plugins, comments, or posts. The class contains almost all necessary methods for displaying, sorting, paginating, and searching data and and what is more obvious than to use it for your own plugins? This article tries to give you a comprehensive walk-through all necessary […]

drop-ins-plugins-600x207

WordPress Dropins

Plugins are pretty popular, since it is easy to adjust your blog or website to your liking with Plugins. Less popular are Dropins. WordPress alows to replace some functions with Dropins. The list of possibilities isn’t big and not well documented. But I like to use Dropins to enhance the possibilties of caching, especially APC […]

wordpress-code-small

Dynamic Copyright Year In Your Footer

The new year is already some days old but in many websites you still can see in their footer “copyright © 2006-2008 mysite.com”. Yeah Andy, on your blog too 😉 For everyone, who changes the year in their footer manually every year, here is a little tip: <p>copyright © 2006-<?php echo date(‘Y’); ?> mysite.com</p> With […]

wordpress-logo-small

WordPress and register_sidebar

Everyone who is building WordPress Themes probably implement the widget function in their theme. Code for the widgets is in functions.php. Here a code snippet of the default theme:       if ( function_exists(‘register_sidebar’) ) register_sidebar(array( ‘before_widget’ => ‘<li id=”%1$s”>’, ‘after_widget’ => ‘</li>’, ‘before_title’ => ‘<h2>’, ‘after_title’ => ‘</h2>’, )); As we all know, […]