ThemeShaper Forums » Thematic

[closed]

Filter thematic_content plus custom loop

(8 posts)
  • Started 8 years ago by ryancollier
  • Latest reply from ryancollier
  • This topic is resolved
  1. ryancollier
    Member

    Okay, so I'm trying to filter thematic_content so that when I'm on my sites homepage (using front-page.php) I get an excerpt. But it's just not working. I'm always getting the full content. If I change is_front_page() to is_home() it works on my blog. So it seems the problem has something to do with my loop in front-page.php? Here's my filter in functions.php:

    function chips_content() {
    	if (is_front_page()) {
    		$content = 'excerpt';
    	}
    	return $content;
    }
    add_filter('thematic_content','chips_content');

    Here's my custom loop:

    $featuredPosts = new WP_Query();
        				$featuredPosts->query('showposts=1');
    
    					?>
    
    					<?php while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
    
    						<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">
        						<?php thematic_postheader(); ?>
    								<div class="entry-content">
    									<?php thematic_content(); ?>
    
    								</div>
    							<?php thematic_postfooter(); ?>
    						</div><!-- .post -->
    
    					<?php endwhile; ?>

    Thanks for your help!

    Posted 8 years ago #
  2. front-page.php is a page template right?
    so instead of

    is_front_page()
    use
    is_template('front-page.php')

    Hope this helps

    Posted 8 years ago #
  3. ryancollier
    Member

    Unfortunately, that didn't work either. I'm not sure, but I feel like I'm totally missing something here...

    It seems like some of my tests work and others don't. For instance, filtering thematic sidebar on the front page works fine, but filtering thematic_content doesn't. I'm wondering if I'm filtering the wrong thing all together or if there's some logic somewhere that's not working because I'm using a page template.

    Posted 8 years ago #
  4. well I did stupidly give you the wrong function name, maybe that is an issue the correct conditional should be

    if(is_page_template('front-page.php') { etc... }

    Rather than is_template(...)

    Posted 8 years ago #
  5. Which version of Thematic are you using? The 0.9.7.5 (currently svn only) is better equipped for this.

    Using that version if you add thematic_abovepost to you loop it should work fine.

    <?php while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
           <?php thematic_abovepost();?>
           <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">

    -Gene

    Posted 8 years ago #
  6. ryancollier
    Member

    Hey Gene.

    Thanks for your help. I'm using 0.9.7.4 right now, but I can update to the latest and try it out.

    So, can you shed a little light on what adding thematic_abovepost()is going to do for my loop and why that might change conditional tests such as is_front_page() and is_page_template() ?

    Posted 8 years ago #
  7. Hi Ryan,

    If you upgrade to 0.9.7.5 have a look at this thread. http://forums.themeshaper.com/topic/latest-svn-copy. I think the functionality you need for my code to work is in the version you are using.

    The thematic_content filter resides in

    thematic_content_init()

    which is hooked into thematic_abovepost if you don't have that hook in your custom loop the filter won't get applied properly nor will aspects of the

    thematic_post_class()

    -Gene

    Posted 8 years ago #
  8. ryancollier
    Member

    Yep. That did it. Thanks all for helping out!

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.