various ways of using wordpress
DESCRIPTION
Presentation slides for WordCamp Toronto 2009 by Nick La, www.ndesign-studio.com.TRANSCRIPT
VARIOUS WAYS OF USING
WordPress
BY: NICK LA
www.ndesign-studio.com
Customizing
Big Thanks to WordPress!
N.Design Studiondesign-studio.com
Web Designer Wallwebdesignerwall.com
Best Web Gallerybestwebgallery.com
IconDockicondock.com
Why WordPress?
• Easy to learn & useGood documentation and simple admin panel
• Flexible and dynamicCreate dynamic sites with Template Tags
• SEO friendlyFriendly URL and semantic coding
• FREE!Free open source + plugins and themes
Things You Should Know
• Custom Fieldshttp://codex.wordpress.org/Using_Custom_Fields
• Conditional Tagshttp://codex.wordpress.org/Conditional_Tags
• Query_Postshttp://codex.wordpress.org/Template_Tags/query_posts
• Page Templatehttp://codex.wordpress.org/Pages
• Finding Good Pluginshttp://wordpress.org/extend/plugins
How I Use WordPress:
Blog Gallery Shop
webdesignerwall.com bestwebgallery.com icondock.com
Using WordPress As
Blog
Displaying A Custom Post Image
Custom Fields
Custom field
Use custom field to display a post image
Custom Fields
Custom field Image URL
Assigning custom field (Admin > Write)
Custom Fields
<?php $postimage = get_post_meta($post->ID, 'post_image', true); ?>
<?php if ($postimage != "") { ?> <a href="<?php the_permalink() ?>"><img src="<?php echo $postimage; ?>" /></a><?php } ?>
index.php
Outputting custom field in template file
Displaying A Dynamic <title> Tag
Conditional Tags
<title> <?php if (is_home()) { echo bloginfo('name'); } elseif (is_404()) { echo '404 Not Found'; } elseif (is_category()) { echo 'Category:'; wp_title(''); } elseif (is_search()) { echo 'Search Results'; } elseif ( is_day() || is_month() || is_year() ) { echo 'Archives:'; wp_title(''); } else { echo wp_title(''); } ?></title>
header.php
Use Conditional Tags to display a dynamic <title> tag
Using WordPress As
Gallery
Managing Posts With Custom Fields
Custom Fields
Large Image
URL
Thumb
Use custom fields to display post content
Plugin: Custom Write Panel
Custom Write Panelhttp://wordpress.org/extend/plugins/custom-write-panel/
Save time by using Custom Write Panel plugin to manage posts
Theme Switcher
Plugin: Theme Switcher
Theme Switcherhttp://wordpress.org/extend/plugins/theme-switcher/
Thumbnail Large Preview Details
With Theme Switcher, visitors can pick their layout preference
ThemesOverview of template files
PHP Include
<?php if (is_page()) { include ('./wp-content/themes/master/page.php');} elseif (is_404()) { include ('./wp-content/themes/master/404.php');} elseif (in_category(8)) { include ('./wp-content/themes/master/category-8.php');} elseif (is_single()) { include ('./wp-content/themes/master/single.php');} else {?>
<?php include ('./wp-content/themes/master/header.php'); ?> <div>. . . display posts . . . </div> <?php include ('./wp-content/themes/master/sidebar.php'); ?> <?php include ('./wp-content/themes/master/footer.php'); ?> <?php }?>
Use Conditional Tags to dynamically include template file from the “master” theme
/* Theme Name: Details*/
Using WordPress As
Shop / Blog
Displaying The 5 Latest Posts
Query_Posts
Display 5 latest posts
Use query_posts to display the 5 latest posts
Query_Posts
<?php query_posts('showposts=5'); ?>
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); $loopcounter++; ?> <?php if ($loopcounter <= 1) { ?> <div> first post content </div> <ul class="recent-post"> <?php } else { ?> <li> last 4 post links </li> <? } ?><?php endwhile;?> </ul><?php else : ?> ...code...<?php endif; ?>
index.php
Sample code: query_posts and the loop
Conditional Tags
<?php if (in_category('28')) { ?> <p>credits</p> <?php if(function_exists('the_ratings')) { the_ratings(); } ?><?php } else { ?> <p>regular post data</p><? } ?>
If the post is in the free icon category, display the post rating plugin
Managing Free Icon Posts With Custom Fields
Custom Fields
download url
WP PostRatingshttp://wordpress.org/extend/plugins/wp-postratings/
preview
description
credits
Custom fields on the free icon page
Plugin: Flutter
Flutter http://flutter.freshout.us
Use Flutter to manage the free icon posts
Getting Rid Of The Category Base
Free Icon TemplateCreating a Page template for the free icon page
<?php/*Template Name: Template - Free Icons*/?>
<?php get_header(); ?>
<?php $page_num = $paged;if ($pagenum='') $pagenum =1;query_posts('cat=28&posts_per_page=-1&paged='.$page_num); ?>
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <div> display post here </div> <? endwhile;endif; ?>
<?php get_sidebar(); ?><?php get_footer(); ?>
template-free-icon.php
Free Icon TemplateCreate a blank page (Free Icons) and assign the template
blank page (no content)
Page template
Creating A Shop With WP ECommerce Plugin
Download WP eCommercehttp://www.instinct.co.nz/e-commerce/
Inspiration
45Royale Inc.http://www.45royale.com
Creative Departhttp://www.creativedepart.com
Typographicahttp://new.typographica.org
FlickOuthttp://flickout.com
Jeff Finleyhttp://www.jefffinley.org
Thank You