for the style.css
<link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet" type="text/css">
the template directory
<script src="<?php echo get_template_directory_uri();?>/js/sample.js"></script>
to display the primary menu
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>to display a specific menu
<?php wp_nav_menu( array('menu'=>'menu_name') ); ?> or
<?php wp_nav_menu($args);?>
<?php $defaults = array(
'theme_location' => ,
'menu' => ,
'container' => 'div',
'container_class' => 'menu-{menu slug}-container',
'container_id' => ,
'menu_class' => 'menu',
'menu_id' => ,
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => ,
'after' => ,
'link_before' => ,
'link_after' => ,
'items_wrap' => '<ul id=\"%1$s\" class=\"%2$s\">%3$s</ul>',
'depth' => 0,
'walker' => );
?>
to display the search form
<?php get_search_form();?>
head
<?php wp_head();?>
footer
<?php wp_footer();?>
get head
<?php get_header();?>
get footer
<?php get_footer();?>
get sidebar
<?php get_sidebar();?>
to query posts
<?phpquery_posts('posts_per_page=3'.'&paged='.$paged);
?>
to reset query
<?phpwp_reset_query();
?>
to query posts in array format
<?php$args=array(
'showposts' => 5,
'paged'=>$paged
);
query_posts($args);
?>
the loop
<?php while(have_posts()):the_post();> <?php the_post_thumbnail();?> // featured image of the post
<?php the_title();?> //post's title
<?php the_author();?> //post's author
<?php the_permalink();?> //post's permalink
<?php the_date();?> //post's date
<?php the_content();?> //full content
<?php the_excerpt();?> //content with limited text
<?php the_time();?> //default
<?php the_time('l, F jS, Y') ?> //using date format
Here are some examples of date format and result output.
F j, Y g:i a - November 6, 2010 12:50 am
F j, Y - November 6, 2010
F, Y - November, 2010
g:i a - 12:50 am
g:i:s a - 12:50:48 am
l, F jS, Y - Saturday, November 6th, 2010
M j, Y @ G:i - Nov 6, 2010 @ 0:50
Y/m/d \a\t g:i A - 2010/11/06 at 12:50 AM
Y/m/d \a\t g:ia - 2010/11/06 at 12:50am
Y/m/d g:i:s A - 2010/11/06 12:50:48 AM
Y/m/d - 2010/11/06
//determines the difference between two timestamps.
<?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?>
// to display the comment count
<?php comments_number( $zero = "0 Reply", $one = "1 Reply", $more = "% Replys.", $deprecated = '' );?> <?php endwhile;?>
for pagination
<?php query_posts('posts_per_page=3'.'&paged='.$paged);?> //to enable pagination <?php previous_posts_link('« Previous') ?> //previous link
<?php next_posts_link('More »') ?> //next link
calls the page content
<?php get_template_part( 'content', 'page' ); ?>
for footer dynamic sidebars
<div id="footer-sidebar" class="secondary"><div id="footer-sidebar1">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?>
<?php endif; ?>
</div>
<div id="footer-sidebar2">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(4) ) : ?>
<?php endif; ?>
</div>
<div id="footer-sidebar3">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(5) ) : ?>
<?php endif; ?>
</div>
<div style="clear:both"></div>
</div>
nice tutorial
ReplyDelete