ThemeShaper Forums » Thematic


can't get childtheme_override_single_post to work

(12 posts)
  • Started 9 years ago by krowchuk
  • Latest reply from daveydz3
  • This topic is resolved
  1. This should work? Right?
    This should display MMMM at the top of the post and BACON at the bottom of the post?

    // Customizing post markup with childtheme override
    function childtheme_override_single_post() { 
    				thematic_abovepost(); ?>
    				<div id="post-<?php the_ID();
    					echo '" ';
    						echo '>';
    					} else {
    						echo '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 -->

    But the post just shows as normal without my bacon!

    Any ideas?

    Posted 9 years ago #
  2. works for me. i get bacon... and mmmm bacon, indeed. thematic

    Posted 9 years ago #
  3. Weird! What could I be doing wrong? I'm using 9.7.7 and my other overrides work.

    Do I have to do an add_action at the end of it?

    Does placement in functions.php matter?

    Sorry, I'm on my iPhone right now so can't test those thoughts.

    Posted 9 years ago #
  4. maybe? can't say. i know there were some issues w/ the add_action being inside the regular function and thus the override wasn't getting added to the hook. don't know if it was a problem w/ the single loop, but i'd try updating thematic to see if that helps.

    Posted 9 years ago #
  5. Hmmm... This was a fresh install from wp rep. How do I get the version you are running? Worth a try I guess!

    Posted 9 years ago #
  6. Oh my, I feel rather obtuse!

    Just for chuckles I created a new blank child functions.php and added only this override. Reloaded my page and didn't see the bacon.

    Scratching my head I suddenly had the thought that maybe I should look at a "post" instead of a "page" - I had been reloading a "page" over and over... Uhmm hey krowchuk.... so indeed the override works as expected on single posts. Oh boy! ;-)

    So that raises the big question...

    Is there an override for pages as well?
    I tried going through but couldn't find anything in /library/ that addresses overriding page.

    The mods I am trying to do, would be site wide, pages (including all custom templates), posts, archives, 404 etc. And it is a very simple (aesthetic only) mod - so I am thinking there might be a better way to attack this.

    Essentially all I am trying to do with this function is add a self closing div directly beneath .entry-content and another one immediately above </div><!-- end .entry-content -->

    So, it would create code like this:

    <div class="entry-content">
      <div class="top"></div>
       content displayed here
      <div class="bottom"></div>
    </div><!-- end .entry-content -->

    .top and .bottom will only display a background image for aesthetics

    Posted 9 years ago #
  7. there isn't a page override, tho sometimes i wished there was. to override the page "loop", you copy page.php into your child theme and it will get used thanks to template hierarchy

    Posted 9 years ago #
  8. Thanks Kathy,
    I agree, would be nice if this was added in the future, or perhaps a hook above and maybe below the .entry-content - as in my case where I wanted a custom background behind/around my post content but not my post title, meta or utility. Of course if people would just stop using ie lt9 then we could use css to achieve the same with less overhead!! ;-)

    Is there a place to ask for future considerations like this?

    Actually, I think it will turn out to be better for me to copy and mod page.php into my child, cuz I am pretty sure that I'm going to have to mod / create a couple more page template layouts to finish this project.

    Thanks for your help and support and sorry to pull a d-oh and wild goose chase!

    Posted 9 years ago #
  9. maybe here:

    people stop using IE? YES PLEASE!

    Posted 9 years ago #
  10. so to hijack this thread, my issue is that i'll put in the code above to override thematic_singlepost but it doesn't work. in fact it creates a server error.

    however, if i put childtheme_override_single_post() { } the site is fine, no error but it also doesn't affect the single post. the moment i put something inside the braces, it server error outs. for example, childtheme_override_single_post() { ?> <h1>Hello</h1> <?php } and it dies. anyone know why this is happening. i don't have the function anywhere else in my functions file and everything else seems all systems go, this seems to be the only issue i'm dealing with.

    please help. Thanks!

    Posted 8 years ago #
  11. interesting, after trying it one more time, it seems to work. weird glitch perhaps or missing code idk, i copied it from the extentions when it didn't work.

    oh well, please disregard :)

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.