background preloader

Theme development

Facebook Twitter

Navigation Menus. Navigation Menus Languages: English • 日本語 • Slovenčina • 中文(简体) • (Add your language) Navigation Menu is a theme feature introduced with Version 3.0.

Navigation Menus

WordPress includes an easy to use mechanism for introducing customised navigation menus into a theme. In order to incorporate menu support into your theme, you need to add a few code segments to your theme files. Function Reference Register Menus Firstly, in your theme's functions.php, you need to write a function to register the names of your menus. Function register_my_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_my_menu' ); And this would make two menu options appear, header menu and extra menu - function register_my_menus() { register_nav_menus( array( 'header-menu' => __( 'Header Menu' ), 'extra-menu' => __( 'Extra Menu' ) ) ); } add_action( 'init', 'register_my_menus' ); Display Menus on Theme Once you've done that, your theme will be almost ready.

<? Menus Panel External Resources Related. Wordpress-Cheat-Sheet.pdf (application/pdf-object) The anatomy of a WordPress theme. Index.php – home The index file controls what the homepage of your WordPress theme looks like. By default it is a loop that queries and then displays the most recent blog posts, with a link in the bottom to view previous posts. Alternately, you can specify in wp-admin -> settings -> reading to have the home page be a page you created yourself in WordPress. In that case, you specify a different page/URL for the regular blog posts to appear on, and that page is generated by index.php. single.php – individual posts The display of individual posts in your WordPress theme is controlled by a little file called single.php.

You can specify if you want sidebars (and which you want), if you want it to look different than the other pages on the site. page.php – individual pages Page.php controls what pages look like. WordPress also allows you to create different page templates within your WordPress theme for different types of pages. Archive.php, category.php, tag.php – archives The Loop. WordPress Theme Development Tools. Update: We’ve created a second edition of this article, with updated code samples and coverage of the latest theme development techniques.

WordPress Theme Development Tools

Check it out at WordPress Theme Development Tools. It’s part of The ThemeShaper WordPress Theme Tutorial: 2nd Edition. Before we get started building any WordPress Theme we’re going to need to get our development tools in place. In this post, we’ll run through the best of the best and build ourselves a cross-platform WordPress Theme test environment that would do a professional Theme developer proud. A Local Test Server: XAMP or MAMP The best place to develop your custom WordPress Theme is off the web, on your home computer. Installing these separate server programs can be technically challenging but luckily for us there are a couple of free programs that will install and manage all this for us.

If you’re on a Windows computer you’ll want to try out XAMP. If you’re running a Mac you’ll want to download MAMP. WordPress Dummy Content A Text Editor Firefox. Theme Development Checklist.