ThemeShaper Forums » Thematic

[closed]

Setting up the post content

(5 posts)
  • Started 2 years ago by iCristiano
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. iCristiano
    Member

    Hi friends,

    I want to custom my post contents and found the thematic_content_init().
    The problem is that, for the 'tax' page, I just want to have posttile and postmeta, with no postcontent. The code should be:

    function childtheme_content($content) {
    	if (is_tax()) {
    		$content= 'XXXXXX';}
    	return $content;
    }
    add_filter('thematic_content', 'childtheme_content');

    I just don´t know what to put in place of the 'XXXXXX'... I tried 'null' or just '', and it didn´t work. Ir works fine with 'full' and 'excerpt', but if I don´t want to show any content?

    Thanks!!

    Posted 2 years ago #
  2. thanks for creating the new post. thematic_content is probably the most confusing b/c people make assumptions about what it does since it is named thematic_content. the thematic_content filter is located in the thematic_content_init() function and the thematic_post filter is located in the thematic_content() function. important to note (was a major breakthrough when i learned this) that the filter you need to hit is not, necessarily named the same as the function it lives in.

    the thematic_content filter sets up whether you get served a "type" (for lack of a better word) of content. thematic only has "excerpt" and "full" defined. you can pass it a new value here... lets try the string "null", but then you must define what "null" displays in the thematic_content function, which confusingly uses the thematic_post filter.

    try this:

    function childtheme_content($content) {
    	if (is_tax()) {
    		$content= 'null';}
    	return $content;
    }
    add_filter('thematic_content', 'childtheme_content');
    
    function childtheme_post($post) {
    	global $thematic_content_length;
    
    	if ( strtolower($thematic_content_length) == 'null' ) {
    		$post= '';
            }
    	return $post;
    }
    add_filter('thematic_post', 'childtheme_post');

    if it doesn't work, then i'll actually test it out later.

    Posted 2 years ago #
  3. iCristiano
    Member

    Perfect! Yes, it works!
    Thanks again, Helga.

    Posted 2 years ago #
  4. iCristiano
    Member

    The problem is that the <div class="entry-content"></div> is empty but is still there, with its margins, occupying an empty space... what should I do to solve it? Use negative margins?

    Posted 2 years ago #
  5. hmmmm.... why does everyone want to use negative margins. fix the markup and you don't need them.

    instead of what i've give you above you could use this to modify the loop

    function childtheme_override_archive_loop() {
    
    	if(is_tax()){
    		//taxonomy modified loop
    
    		while ( have_posts() ) : the_post(); 
    
    				thematic_abovepost(); ?>
    
    				<div id="post-<?php the_ID();
    					echo '" ';
    					if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    						post_class();
    						echo '>';
    					} else {
    						echo 'class="';
    						thematic_post_class();
    						echo '">';
    					}
         				thematic_postheader();
    
                                   //look the content is gone! ?>
    
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    
    			<?php 
    
    				thematic_belowpost();
    
    		endwhile;
    	} else {
    		//default archive loop
    		while ( have_posts() ) : the_post(); 
    
    				thematic_abovepost(); ?>
    
    				<div id="post-<?php the_ID();
    					echo '" ';
    					if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    						post_class();
    						echo '>';
    					} else {
    						echo 'class="';
    						thematic_post_class();
    						echo '">';
    					}
         				thematic_postheader(); ?>
    					<div class="entry-content">
    <?php thematic_content(); ?>
    
    					</div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    
    			<?php 
    
    				thematic_belowpost();
    	}
    }
    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.