Skip to content

Instantly share code, notes, and snippets.

@scottnix
Created September 17, 2012 17:29
Show Gist options
  • Save scottnix/3738633 to your computer and use it in GitHub Desktop.
Save scottnix/3738633 to your computer and use it in GitHub Desktop.
Thematic Override Index Loop and Single Post Loop
function childtheme_override_index_loop() {
// Count the number of posts so we can insert a widgetized area
$count = 1;
while ( have_posts() ) : the_post();
// action hook for insterting content above #post
thematic_abovepost();
echo '<div id="post-' . get_the_ID() . '" ';
// Checking for defined constant to enable Thematic's post classes
if ( ! ( THEMATIC_COMPATIBLE_POST_CLASS ) ) {
post_class();
echo '>';
} else {
echo 'class="';
thematic_post_class();
echo '">';
}
// creating the post header
thematic_postheader();
?>
<div class="entry-content">
<?php thematic_content(); ?>
<div class="custom-fields">
<div class="cf-location">
<?php the_field('location'); ?>
</div>
</div>
<?php wp_link_pages('before=<div class="page-link">' . __('Pages:', 'thematic') . '&after=</div>') ?>
</div><!-- .entry-content -->
<?php thematic_postfooter(); ?>
</div><!-- #post -->
<?php
// action hook for insterting content below #post
thematic_belowpost();
comments_template();
if ( $count == thematic_get_theme_opt( 'index_insert' ) ) {
get_sidebar('index-insert');
}
$count = $count + 1;
endwhile;
} // end index_loop
function childtheme_override_single_post() {
// action hook for insterting content above #post
thematic_abovepost();
echo '<div id="post-' . get_the_ID() . '" ';
// Checking for defined constant to enable Thematic's post classes
if ( ! ( THEMATIC_COMPATIBLE_POST_CLASS ) ) {
post_class();
echo '>';
} else {
echo 'class="';
thematic_post_class();
echo '">';
}
// creating the post header
thematic_postheader();
?>
<div class="entry-content">
<?php thematic_content(); ?>
<div class="custom-fields">
<div class="cf-location">
<?php the_field('location'); ?>
</div>
</div>
<?php wp_link_pages('before=<div class="page-link">' . __('Pages:', 'thematic') . '&after=</div>') ?>
</div><!-- .entry-content -->
<?php thematic_postfooter(); ?>
</div><!-- #post -->
<?php
// action hook for insterting content below #post
thematic_belowpost();
} // end single_post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment