10
Tweaking Your Theme

Intro to WordPress Development: Tweaking your Theme

Embed Size (px)

DESCRIPTION

WordCamp Louisville 2011

Citation preview

Page 1: Intro to WordPress Development: Tweaking your Theme

Tweaking Your Theme

Page 2: Intro to WordPress Development: Tweaking your Theme

• Guide new users to become more familiar with their theme• Tips to tweaking design• Share resources with easy to understand tutorials for

helping users customize their themes• Why code snippets can be a better choice than plugins• A touch on child theming

 

Page 3: Intro to WordPress Development: Tweaking your Theme

You need to be familiar with WordPress (basic concepts of taxonomy, the loop, and at least the required functions to get a theme working. You need to be familiar with PHP, HTML, CSS, and making graphics.

Page 4: Intro to WordPress Development: Tweaking your Theme

Basic• 404.php• archives.php• comments.php • footer.php• functions.php • header.php• index.php• page.php• search.php • sidebar.php• single.php

Others • author.php• category.php• home.php

  More template files to consider at above link.

 

Page 5: Intro to WordPress Development: Tweaking your Theme

<!-- Start the Loop. --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>  <div class="post" id="post-<?php the_ID(); ?>">  <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>  <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small> <div class="entry"> <?php the_content(); ?> </div> <p class="postmetadata">Posted in <?php the_category(', '); ?></p></div> <?php endwhile; else: ?>  <p>Sorry, no posts matched your criteria.</p> <?php endif; ?>

Page 6: Intro to WordPress Development: Tweaking your Theme

http://codex.wordpress.org/Child_Themes A child theme basically overwrites some of the active parent theme to add style or certain functionalities not originally developed or designed in the original theme.  

Page 7: Intro to WordPress Development: Tweaking your Theme

Plugins are great and normally versatile when you are changing from theme to another theme. Code snippets are theme specific. While plugins are awesome, code snippets can cut down data resources and memory with your web host.  While adding snippets to another theme each time you change your theme is tedious, you are saving yourself grief from your host. Those of you with quickly growing sites will eventually have this issue and seek memcache, CDN and/or bigger hosting service plans. Do yourself a favor and give yourself a plugin diet.

Page 8: Intro to WordPress Development: Tweaking your Theme

Code Snippet to limit excerpt lengthadd_filter('excerpt_length', 'my_excerpt_length');function my_excerpt_length($len) { return 100; }

Code Snippet for Post Thumbnailadd_theme_support( 'post-thumbnails' );set_post_thumbnail_size( 150, 150, true ); // Normal post thumbnailsadd_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink

thumbnail size

These simple things go in the functions.php template file.

Page 9: Intro to WordPress Development: Tweaking your Theme

• WPhacks.com• JustinTadlock.com• Themeshaper.com• WPBeginner.com• WPAddict.net• Digwp.com• Perishablepress.com• WPRecipes.com

 

Page 10: Intro to WordPress Development: Tweaking your Theme

[email protected] Twitter: @blondishnet OR @wpaddict Facebook: fb.com/NileFlores or

fb.com/WPAddict