Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Template Name: Lead Like Jesus Devotionals
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
<div id="container">
<div id="content">
<?php
$type = 'leadlikejesus';
$args=array(
'post_type' => $type,
'post_status' => 'publish',
'paged' => $paged,
'posts_per_page' => 10,
'caller_get_posts'=> 1
);
$temp = $wp_query; // assign original query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query($args);
?>
<?php
get_template_part( 'loop', 'index' );?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php
/**
* Template Name: Lead Like Jesus Devotionals
*
* Selectable from a dropdown menu on the edit page screen.
*/
<?php
/** following code block added by vmf on 11/12/2010
* registers custom post type 'leadlikejesus'
* caution: if template gets updated by developer
* this file may get overwritten and you will have to restore
* this functionality. Make sure you save it someplace safe.
*/
// execute the create_post_type() function
add_action( 'init', 'create_post_type' );
function create_post_type() {
// create an array for all of the display prompts
$labels = array(
'name' => __( 'Devotionals' ),
'singular_name' => __( 'Devotional' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Devotional' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit Devotional' ),
'new_item' => __( 'New Devotional' ),
'view' => __( 'View Devotional' ),
'view_item' => __( 'View Devotional' ),
'search_items' => __( 'Search Devotionals' ),
'not_found' => __( 'No devotionals found' ),
'not_found_in_trash' => __( 'No devotionals found in Trash' ),
'parent_item_colon' => ''
);
// create an array for the arguments to pass to register_post_type()
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'_builtin' => false, // It's a custom post type, not built in!
'rewrite' => array('slug' => 'devotionals'),
'capability_type' => 'post',
'hierarchical' => false,
'supports' => array( 'title', 'author', 'editor', 'comments', 'trackbacks', 'sticky', 'excerpt', 'custom-fields', 'thumbnail', 'page-attributes' )
);
// register the new custom post type
register_post_type( 'leadlikejesus', $args);
// flush the rewrite rules to prevent 404 error
flush_rewrite_rules();
}
// end custom post type 'leadlikejesus'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment