Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shoestrap WordPress Plugin Drop-In Overrides Shoestrap WordPress Theme Defaults
<?php
/*
Plugin Name: Shoestrap Custom Templates
Plugin URI: http://shoestrap.org
Description: This plugin replaces the default templates with our custom ones using the hooks provided by the <a href="http://shoestrap.org/downloads/shoestrap">Shoestrap</a> theme
Version: 1.00
Author: Aristeides Stathopoulos
Author URI: http://aristeides.com, http://shoestrap.org/forums/topic/template-actions-file, https://gist.github.com/aristath/5496734, https://gist.github.com/payingattention/5689514
*/
/*
* Our custom template for single posts
*/
function my_custom_single_content_template() { ?>
<?php while ( have_posts() ) : the_post(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<header>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php get_template_part( 'templates/entry-meta' ); ?>
</header>
<div class="entry-content">
<?php do_action( 'shoestrap_before_the_content' ); ?>
<?php the_content(); ?>
<?php do_action( 'shoestrap_after_the_content' ); ?>
</div>
<footer>
<?php wp_link_pages( array( 'before' => '<nav id="page-nav"><p>' . __( 'Pages:', 'shoestrap' ), 'after' => '</p></nav>' ) ); ?>
<?php the_tags( '<i class="icon-tags"></i>',', ','' ); ?>
</footer>
<?php comments_template( '/templates/comments.php' ); ?>
</article>
<?php endwhile; ?>
<?php
}
/*
* The metadata template
* i #@context edited
* (1) lowercase "By"
* (2) set Time and Tag Spans to let tags show without huge tag columning
*/
function my_custom_article_metadata_template() { ?>
<p class="byline author vcard"><?php echo __( 'by', 'shoestrap' ); ?>
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author" class="fn"><?php echo get_the_author(); ?></a>
</p>
<div class="row-fluid">
<div class="span2">
<i class="time-icon icon-time-alt"></i>
<time class="updated" datetime="<?php echo get_the_time( 'c' ); ?>" pubdate><?php echo get_the_date(); ?></time>
</div>
<div class="span8">
<?php if ( has_tag() ) { ?>
<i class="icon-tags"></i>
<?php the_tags(''); ?>
<?php } ?>
</div>
<div class="span2">
<?php if ( get_comments_number() >= 1 ) { ?>
<i class="icon-comment"></i>
<?php comments_number(); ?>
<?php } ?>
</div>
</div>
<?php
}
// ********************************* now do replacing: **************************************************
/*
* replace the default post template with our custom template
*/
function replace_my_custom_single_product_template() {
add_action( 'shoestrap_single_content', 'my_custom_single_content_template', 10 );
remove_action( 'shoestrap_single_content', 'shoestrap_single_content_template', 10 );
}
add_action( 'shoestrap_single_content', 'replace_my_custom_single_product_template', 1 );
/*
* #@context replace metadata template with our custom template
*/
function use_my_custom_article_metadata_template() {
add_action( 'shoestrap_do_metadata', 'my_custom_article_metadata_template', 10 );
remove_action( 'shoestrap_do_metadata', 'shoestrap_article_metadata', 10 );
}
add_action( 'shoestrap_do_metadata', 'use_my_custom_article_metadata_template', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.