Transcript Slide 1
Basics of Administration & Theming
- Smarajit Dasgupta
Brief History
Based on blogging platform b2, built in mid-2001 by
Michel Valdrighi who seemingly abandoned it after 2
years
Fortunately, a b2 fan, Matt Mullenweg developed
Wordpress in 2003
23rd Feb 2011 : Wordpress latest stable version 3.1
released and has already been downloaded 875,950 +
times as on Feb 27th 2011
5 minute Install in WAMP
Copy Wordpress files into localhost folder
Run WAMP. Create database using PHPMyAdmin
In WP folder, rename wp-config-sample.php to wp-
config.php
Open wp-config.php, and edit details : Database
name, database user = ‘root’ database password = ‘’
In browser enter http://localhost/site-folder-name
Fill site info
File Structure
/
wp-admin/
wp-content/
plugins/
Each plugin usually has its own directory
themes/
Each theme has its own directory
uploads/
Created on first upload (default location)
wp-includes/
wp-config.php
Wordpress Themes
A way to skin Wordpress
WordPress themes are a combination of PHP, CSS, and
image files
Requirements:
HTML
CSS
Some PHP
Theme Structure
Index.php
Homepage
includes header.php
Includes sidebar.php
Includes footer.php
index.php
home.php
Single Post page
single.php
Page
Category
•
tag.php
Search Results
–
•
category.php
archive.php
Tags
–
•
page.php
search.php
404 error
–
404.php
The Stylesheet - Style.css
Defines how HTML will look / controls the layout and design elements of your
theme…
The comment headers in the style.css provide meta info to WP are are
REQUIRED. It defines theme name, creator etc
Functions.php
Contains theme related functions and commonly is used to generate dynamic
sidebars etc.
Loop.php
If (havePosts)
show post stuff
Else
nothing here!
End if
Template tags
•
•
•
•
•
•
•
•
http://codex.wordpress.org/Template_Tags
<?php the_title(); ?> title of a specific post / page
<?php the_permalink(); ?> URL of a page /post
<?php the_content(); ?> content of posts
<?php the_category(); ?>
<?php get_header(); ?>
<?php get_footer(); ?>
<?php get_sidebar(); ?>
• And more! (continued later)
What Is A WordPress Plugin?
Plugins are used to add or enhance functionalities of
your WordPress site. Example: plugins for contact
forms,
Over 13,000 plugins available currently
http://wordpress.org/extend/plugins/
Extra Stuff
Custom permalinks /%postname%/
Include any file <?php include(TEMPLATEPATH./’x’); ?>
Title of the site <?php bloginfo(‘name’); ?>
Title of specific page /post <?php wp_title(); ?>
Stylesheet location <?php bloginfo(‘stylesheet_url’); ?>
Location of theme file <?php bloginfo(‘template_url’); ?>
List pages of site <?php wp_list_pages(); ?>
Including pages by ID <? php wp_list_pages(‘include=1,5′); ?>
Sorting Pages <?php
wp_list_pages(’sort_column=post_date’); ?>
Adding menu <?php wp_nav_menu('menuname'); ?>
More on Menus
To add menu position in functions.php
If (function_exists(register_nav_menus)) {
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
'secondary' => 'nav2'
) );
}
To show menu in template files:
<?php wp_nav_menu(array(‘menu’ => ‘nav2’)); ?>