Tag archive for "wordpress-theme"

Preserve options when using multiple pages and the settings api

See my previous paste for the whole class (minus this) http://kuttler.eu/code/wordpress-plugintheme-options-page/ more

WordPress plugin/theme options page

I use helper methods/functions in my themes and plugins to create the input fields, this was simplified for the example here. more

WordPress pagination

wp_enqueue_style, versioning and conditional CSS comments

I like to enqueue my CSS styles because it has the benefit of adding a version string. A link like style.css?ver=0.7 is useful because it will force visitors to download an updated style.css when the version number is increased. Here's what I currently use in my functions.php: <?php if ( ... more

Ajax For All WordPress Blogs

This is a new plugin of mine that will turn many existing WordPress blogs and their themes into Ajax-powered blogs. The best way to see what this plugin does is to look at the live demo. The theme on that site wasn't tweaked at all to make the Ajax functionality ... more

How to add support for navigation menus to your WordPress theme

The new navigation menus system in WordPress 3.0 looks promising, but in my opinion it's not very usable yet. Anyway, here's one way to add navigation menus to your theme while maintaining backward compatibility: In your theme's functions.php add something like the following code: <?php function mytheme_addmenus() { register_nav_menus( array( ... more

Nesting WordPress loops

Sometimes it's useful to put a WordPress loop inside another loop. To do this you'll have to create a new WP_Query object, as in this example: <?php $my_query = new WP_Query( "cat=3" ); if ( $my_query->have_posts() ) { while ( $my_query->have_posts() ) { $my_query->the_post(); the_content(); } } $GLOBALS['post'] = $GLOBALS['wp_query']->post; ... more

Get WordPress comments outside of WordPress

Update: Apparently this code is also necessary when you want to list the comments on the blog page, and probably on archive pages as well. There could be a better solution, if you really care check out the P2 theme (and leave a comment). Sometimes you want to access WordPress ... more

Creating a valid WordPress theme

Recently, I've been checking out some of the blogs that link back to me because they use one of my plugins. And it seems like a lot of them are using buggy, incorrect templates. It looks like many WordPress theme developers don't read the theme development checklist. Another fine document ... more

WordPress 2.7 and the comment pager

Comment paging is a great new feature in WordPress 2.7. However, how do you not display the pager when there are no previous or next comments? After digging through the code for quite a while and chatting with some people here's a solution: <?php if ( have_comments() ) { ?> ... more