How Do I Add a Theme to My WordPress Blog?

Adding a theme to your WordPress blog is easy. All you need is a copy of the theme you want to use, and the WordPress install script. Once you have the install script, follow these simple steps:

1) Log into your WordPress admin area.
2) Click on the Appearance tab in the admin area.
3) In the Theme Selector box, click on the Choose Theme button.
4) Locate and click on the download link for the theme you want to use.
5) Once you have downloaded the theme, open it up in your favorite editor.
6) Locate and copy the contents of the theme’s folder to your WordPress blog’s root directory (this is where all of your blog content lives).

7) In your WordPress blog’s root directory, create a new file called functions.php. This file will contain all of the code necessary to activate and use your new theme.
8) Open up functions.php in your favorite editor and add these lines of code:.

// start of our functions.php file // add our theme’s header function add_theme_header() { ?>

themes->addFooter( array( ‘style’ => ‘min-height: 100px;’, ‘position’ => ‘bottom’, ), false ); else : $post->themes->addFooter( array( ‘style’ => ‘height: 100px;’, ), false ); endif; echo ” “; } // end if if ! empty( $GLOBALS[‘wpdb’] ) : // handles queries for posts with custom taxonomies $GLOBALS[‘wpdb’]->prepare( “SELECT COUNT (*) as num FROM $wpdb->posts WHERE post_type=’page’ AND post_status=’publish'” ); foreach ( $GLOBALS[‘wpdb’] as $post ) : echo “{$post->ID} : {$post->title}”; endforeach; echo “

” ; // end of our footer function } // end of add_theme_footer();.

In this code, we first get our header and footer ready by declaring them within their respective functions. We also check to make sure that we’re on a single post page (since our footer will go at the bottom of each post), and then call into our themes plugin to add our header and footer content.

We also prepare a query to return all posts that are published, using our custom taxonomy that we created earlier in this tutorial. Finally, we loop through each post in our WP database using WP’s prepare function, and output the title and ID for each post.

Related Posts