Top
Home


Get/Echo blog title

<?php $blog_title = get_bloginfo(); echo $blog_title;?>

Tag Line

<?php echo get_bloginfo ( 'description' );  ?>

Title outside of loop

<?php single_post_title(); ?>

Place the Calendar

<?php get_calendar(); ?>

lists categories

<?php the_category('  | '); ?>

Posts by category dropdown

<li id="categories">
<h2><?php _e( 'Posts by Category' ); ?></h2>
<?php wp_dropdown_categories( 'show_option_none=Select category' ); ?>
<script type="text/javascript">
<!--
var dropdown = document.getElementById("cat");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
location.href = "<?php echo esc_url( home_url( '/' ) ); ?>?cat="+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
-->
</script>
</li>

Site URL example Usage

<a href="<?php echo site_url(); ?>">HOME</a>

Post ID #

<?php echo the_ID(); ?>

Classes!

<?php body_class($class); ?>
<?php post_class(fluid_12); ?>
<?php comment_class(); ?>

Date

<?php the_date(); ?>
<?php the_date('Y-m-d', '<h2>', '</h2>'); ?>
<?php $todae = the_date('l, F jS, Y', '<i>', '</i>', FALSE); echo $todae; ?>

Content or Except depending on page

<?php if ( is_category() || is_archive() ) {
the_excerpt();
} else {
the_content();
} ?>

In Functions to make readmore work

function new_excerpt_more( $more ) {
return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . __( 'Read More', 'your-text-domain' ) . '</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );


<p><?php the_content("Continue reading " . get_the_title()); ?></p>

Place Post News Categories In A Div In Template

<li class="widget widget_recent_entries">
<?php $my_query = new WP_Query('category_name=happy&posts_per_page=10');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<h2 class="widgettitle"><?php the_title(); ?></h2>
<ul>
<li><a href="<?php echo get_permalink(); ?>"><?php echo get_the_excerpt(); ?></a></li>
</ul>
<?php endwhile; ?>
</li>

excerpt, no p tags

<?php echo get_the_excerpt(); ?>

excerpt, with p tags

<?php the_excerpt(); ?>