ThemeShaper Forums » Thematic

[closed]

Childtheme_override_single_post

(4 posts)
  • Started 2 years ago by daveydz3
  • Latest reply from daveydz3
  • This topic is not resolved
  1. hello, so childtheme_override_single_post is only working half way. when i put this code into my functions file:

    //override single_post for conditionals
    function childtheme_override_single_post() {
     if( in_category( '65' ) || post_is_in_descendant_category( 65 ) ) {
    //begin single post modified
    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">
    <h1>Single Post Filter Works!</h1>
    <?php thematic_content(); ?>
    
    						<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    					</div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    		<?php
    
    			thematic_belowpost();
    
    }
    else {
    
    //begin single post not modified
    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(); ?>
    
    						<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    					</div><!-- .entry-content -->
    					<?php thematic_postfooter(); ?>
    				</div><!-- #post -->
    		<?php
    
    			thematic_belowpost();
    }
    }

    it works with the conditional as expected, however when i check the posts that use the else statement part of the code, nothing appears besides the header on the page. something in the code is blocking the rest of the page from loading. But when i look at the code above, it doesn't seem like i missing something.

    any ideas?

    Posted 2 years ago #
  2. when i look at the error code, i see that this may be causing the issue: "Call to undefined function post_is_in_descendant_category()"

    but i got that code from the wordpress codex, maybe i'm not using it right?

    Posted 2 years ago #
  3. that isn't a default wordpress function. if you wish to use it you must include it somewhere (like in your functions.php)

    http://codex.wordpress.org/Template_Tags/in_category#Testing_if_a_post_is_in_a_descendant_category#post_is_in_descendant_category_function

    Posted 2 years ago #
  4. ahh, i see. yeah upon further reading i see that i was supposed to included the function first.

    hopefully, they'll just add it into the core at some point.

    Thanks!

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.