Author: latz

  • The selectbox mystery of WordPress

    The other day I wanted to use a selectbox with 5 elements in my plugin’s option page. No problem I thought: What everybody including me expects is something like this: But I actually got this: The mystery lies in the style sheet for the admin area: #wpcontent select { padding: 2px; height: 2em; font-size: 12px;…

  • WordPress: Shorten title

    A frequently asked question in WordPress forum is how to shorten the title of a post to a predefined number of characters and to append a “…”. The problem is solved with a few lines of code: add_filter( ‘the_title’, ‘short_title’ ); function short_title( $title ) { $chars = 20; if ( strlen( $title ) >…

  • Remove “by author” post section from Genesis themes

    As I already wrote in How-to remove the author from your Twenty-Ten posts most blogs do not need the section “by author” since there is only one author. By default most Genesis themes contain this section (e.g. the prose theme): Let’s see how-to remove the author’s name from the post info.

  • WordPress: Remove links from the_category()

    WordPress: Remove links from the_category()

    The standard way to display the categories a post belongs to is to use the function the_category, e.g, the call the_category(‘, ‘); will output: link, photo, regular, video As you see the categories are automatically linked to their respective category pages which in most cases is the style needed. Nevertheless there may be situations where…

  • WordPress plugins: Don’t hard code path names …almost never!

    The other day I found a plugin claiming the following in its instructions: 1) Upload the entire my-cool-plugin folder to the /wp-content/plugins/ directory 2) DO NOT change the name of the my-cool-plugin folder […] What the heck? Why shouldn’t I change the name of the folder? The author didn’t actually hard code the plugin path…

  • WordPress: Unified Login Error Messages

    WordPress: Unified Login Error Messages

    If you log-in to your WordPress blog and use an unregistered username the system will answer “ERROR: Invalid username. Lost your password?” and if you got your username right but not your password: “ERROR: The password you entered for the username admin is incorrect. Lost your password?” So you know independently if you used a…

  • How-to remove the author from your Twenty-Ten posts

    How-to remove the author from your Twenty-Ten posts

    There are more than 1300 themes available in the official Theme Directory but many WordPress blogs are using the default theme Twenty Ten. The default header of a post looks like this: Besides the date of publications the author of the article is displayed but since most blogs are operated by single persons this information…

  • HTML/PHP: Single and double quotes

    HTML/PHP: Single and double quotes

    If PHP programmers are creating a link from variables often you can see the following code: echo ” . $linktext . ”; or ?>

  • WordPress: Disable plugin table paging

    Since WordPress 3.0 the plugin table is paginated by default, 20 entries at a time. In my mind this is totally useless since it means that I have to click through my plugins instead of simply scrolling through them with the mouse wheel. But there’s a more or less “hidden” option to display all plugins…

  • WordPress: Metaboxes are (re-)movable

    WordPress: Metaboxes are (re-)movable

    This might sound like an article for pure beginners but even users with years of WordPress experience are regularly scrolling their dashboard and editing pages up and down to reach the desired metaboxes. Meta what? Metaboxes. Those are the boxes used in the dashboard, the new page, or the new post pages to group the…