11
Introduction to Wordpress Basics of Administration & Theming - Smarajit Dasgupta

Basics of Administration & Theming - Smarajit Dasgupta

Embed Size (px)

Citation preview

Page 1: Basics of Administration & Theming - Smarajit Dasgupta

Introduction to WordpressBasics of Administration & Theming

- Smarajit Dasgupta

Page 2: Basics of Administration & Theming - Smarajit Dasgupta

Brief HistoryBased 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

Page 3: Basics of Administration & Theming - Smarajit Dasgupta

5 minute Install in WAMPCopy Wordpress files into localhost folderRun WAMP. Create database using

PHPMyAdminIn 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

Page 4: Basics of Administration & Theming - Smarajit Dasgupta

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

Page 5: Basics of Administration & Theming - Smarajit Dasgupta

Wordpress ThemesA way to skin WordpressWordPress themes are a combination of PHP,

CSS, and image filesRequirements:

HTML CSS Some PHP

Page 6: Basics of Administration & Theming - Smarajit Dasgupta

Theme Structure Index.php

includes header.php Includes sidebar.php Includes footer.php

Homepage index.php home.php

Single Post page single.php

Page page.php

Category category.php archive.php

• Tags– tag.php

• Search Results– search.php

• 404 error– 404.php

Page 7: Basics of Administration & Theming - Smarajit Dasgupta

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.phpContains theme related functions and commonly is used to generate

dynamic sidebars etc.

Loop.phpIf (havePosts)

show post stuffElse

nothing here!End if

Page 8: Basics of Administration & Theming - Smarajit Dasgupta

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)

Page 9: Basics of Administration & Theming - Smarajit Dasgupta

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 currentlyhttp://wordpress.org/extend/plugins/

Page 10: Basics of Administration & Theming - Smarajit Dasgupta

Extra StuffCustom 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'); ?>

Page 11: Basics of Administration & Theming - Smarajit Dasgupta

More on MenusTo 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’)); ?>