Skip to content

Instantly share code, notes, and snippets.

@scottnix
Last active December 19, 2015 10:59
Show Gist options
  • Save scottnix/5944519 to your computer and use it in GitHub Desktop.
Save scottnix/5944519 to your computer and use it in GitHub Desktop.
Thematic make full post in a certain category clickable. Need JS for this, tries to close any actual link tags.
// make whole post clickable on the index page by adding JavaScript to only that category
// also add a cursor: pointer; in CSS to the div/category
// reference: http://thematictheme.com/forums/topic/wrap-entry-content-in-anchor-tags/
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 inserting content above #post
thematic_abovepost(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class();
if ( in_category( '82' ) ) {
$linkopen = ' onclick="document.location.href =\'';
$linkopen .= get_permalink();
$linkopen .= '\'"';
echo $linkopen;
} ?>> <?php
// creating the post header
thematic_postheader(); ?>
<div class="entry-content"> <?php
thematic_content();
wp_link_pages(array('before' => sprintf('<div class="page-link">%s', __('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;
}
@scottnix
Copy link
Author

Fixed incorrect formatting which caused a HTML formatting error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment