Entries tagged WordPress

KC Settings

Posted on 2010/10/25 Comments

I’ve been writing WordPress themes for these past two years. Some of them are very simple and some others are quite complex. These themes need a settings panel so the user (or the site admin) can configure their site comfortably. There are many methods around the interwebs on how you can create such a settings panel for your theme/plugin. I tried to adapt some of them into my themes, but there was always something wishpering in my ear telling me to write my own settings panel with my own way :) .
Continue…

Add Custom Attributes to WordPress’ Posts Navigation

Posted on 2010/08/28 Comments

The Problem

We need to add our custom class(es) to the posts navigation links to be able to add some styles.

The Solution

Use the available next_posts_link_attributes and previous_posts_link_attributes hooks.

How?

Open your theme’s function.php file and add these lines (must be inside the <?php ?> tag):

add_filter( 'next_posts_link_attributes', 'kc_next_post_link_attr' );
add_filter( 'previous_posts_link_attributes', 'kc_prev_post_link_attr' );

function kc_next_post_link_attr() {
	return 'class="next-page"';
}

function kc_prev_post_link_attr() {
	return 'class="prev-page"';
}