Go to content
Blog / Meta /

Blog re-style (+ bonus: three WordPress tricks)

Some weekends ago, I saved few of my free time to work on my blog.

The most evident change is that now for my blog, I’m using the Ryu theme, by the guys of Automattic.

It had been a long time since the last time I had worked with WordPress, and I really appreciated it. So today I want to share three useful tricks to customize your WordPress implementation.

One of the characteristics of this blog even before the restyle, was that, even if you are logged in WordPress, the top toolbar is not displayed. There are several possible hacks to achieve this behaviour, but my favorite is the following:

Don’t render WordPress toolbar

/* Remove WordPress topbar */
add_filter("show_admin_bar", "__return_false");

The previous code snippet (and even the following) are meant to be added to the theme function file, that is the function.php file.

Change excerpt length

Wordpress allows to define custom length (length is expressed in number of words) for the excerpt.

/* Set the length of the post excerpt */
function set_excerpt_length($length) {
  return 100;
}

add_filter("excerpt_length", "set_excerpt_length");

Customize “Read more” text

Finally, it’s even possible to customize the text that is showed after the excerpt.

/* Customize excerpt "read more" label after the excerpt */
function set_excerpt_read_more($more) {
  return " ...";
}

add_filter("excerpt_more", "set_excerpt_read_more");

As you can see all the example of this post are using the add_filter function; if you want to know more about it, check out the filter documentation.