Snippets
$args = array(
);
$query = new WP_query ( $args );
if ( $query->have_posts() ) { ?>
<h3>Heading</h3>
<?php while ( $query->have_posts() ) : $query->the_post(); /* start the loop */ ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h3 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'compass' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'medium', array(
'class' => 'alignleft',
'alt' => trim(strip_tags( $wp_postmeta->_wp_attachment_image_alt ))
) ); ?>
</a>
<?php } ?>
<section class="entry-summary">
<?php the_excerpt(); ?><a href="<?php the_permalink(); ?>">Further information</a>.
</section><!-- .entry-summary -->
OR
<section class="entry-content">
<?php the_content(); ?>
</section><!-- .entry-content -->
</article>
<?php endwhile; /* end the loop*/ ?>
<?php rewind_posts();
}
function rmmc_create_post_type() {
$labels = array(
'name' => __( 'Weebles' ),
'singular_name' => __( 'Weeble' ),
'add_new' => __( 'New weeble' ),
'add_new_item' => __( 'Add New weeble' ),
'edit_item' => __( 'Edit weeble' ),
'new_item' => __( 'New weeble' ),
'view_item' => __( 'View weeble' ),
'search_items' => __( 'Search weebles' ),
'not_found' => __( 'No weebles Found' ),
'not_found_in_trash' => __( 'No weebles found in Trash' ),
);
$args = array(
'labels' => $labels,
'has_archive' => true,
'public' => true,
'hierarchical' => false,
'supports' => array(
'title',
'editor',
'excerpt',
'custom-fields',
'thumbnail',
'page-attributes'
),
'taxonomies' => array( 'post_tag', 'category'),
);
register_post_type( 'name', $args );
}
add_action( 'init', 'rmmc_create_post_type' );
function rmcc_register_taxonomy() {
$labels = array(
'name' => __( 'Weebles' ),
'singular_name' => __( 'Weeble' ),
'search_items' => __( 'Search Weebles' ),
'all_items' => __( 'All Weebles' ),
'edit_item' => __( 'Edit Weebles' ),
'update_item' => __( 'Update Weebles' ),
'add_new_item' => __( 'Add New Weebles' ),
'new_item_name' => __( 'New Weeble Name' ),
'menu_name' => __( 'Weeble' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'sort' => true,
'args' => array( 'orderby' => 'term_order' ),
'rewrite' => array( 'slug' => 'weebles' ),
'show_admin_column' => true
);
register_taxonomy( 'weeble', 'posttype', $args);
}
add_action( 'init', 'rmcc_register_taxonomy' );