ThemeShaper Forums » Thematic

thematic_postheader() and thematic_postfooter()

(8 posts)
  • Started 5 years ago by sciamannikoo
  • Latest reply from sciamannikoo
  • This topic is not a support question
  1. Hello!

    Without modifying index.php, single.php, hooks-filters.phpetc., there is a way to add something on the two mentioned functions?

    I want to add a DIV on each funtion, to have something like that (see the 4 line ending with "<!-- SOMEHOW ADDED -->"):

    <div id="post-xxx" class="... post ...">
    <div class="myheaderdiv"></div> <!-- SOMEHOW ADDED -->
    <div class="post-contents"> <!-- SOMEHOW ADDED -->
    <h1 class="entry-title">
    </h1>
    <div class="entry-meta">
    </div>
    <div class="entry-content">
    </div>
    <div class="entry-utility">
    </div>
    </div> <!-- SOMEHOW ADDED -->
    <div class="myfooterdiv"></div> <!-- SOMEHOW ADDED -->
    </div>

    I need to do that as my template's layout needs a header and footer image, that uses transparency and can't be overlapped to entry's background (what is supposed to be in "post-contents").

    Any tip?

    Thanks,
    Andrea

    Posted 5 years ago #
  2. I just want to add a note.

    So far, I've walked around the problem, playing with the CSS, but is not a real clean solution. I hope there is a way to solve my problem playing with the hooks.

    Andrea

    Posted 5 years ago #
  3. You have to filter those functions.

    Posted 5 years ago #
  4. Yes, but that means rewriting the whole code.
    On this case, I've eventually found a better (for me) option writing my own index.php, page.php, archive.php, etc. pages.

    Thank anyway.

    Andrea

    Posted 5 years ago #
  5. Andrea,

    don't understand why filtering means rewriting the whole code.

    For instance, adding the first divs above entry-title would require the following function:

    function my_start($posttitle) {
      $content = '<div class="myheaderdiv"></div> <!-- SOMEHOW ADDED -->' . "\n";
      $content .= '<div class="post-contents"> <!-- SOMEHOW ADDED -->' . "\n";
      $content .= $posttitle;
      return $content;}
    add_filter('thematic_postheader_posttitle', 'my_start');

    Cheers,

    Chris

    Posted 5 years ago #
  6. Because I wasn't so clear on my example.

    This is what I exactly need:

    <div class="post-container">
    <div class="post-container-top"></div>
    			<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
        			<?php thematic_postheader(); ?>
    				<div class="entry-content">
    <?php the_content(''.__('Read More <span class="meta-nav">&raquo;</span>', 'thematic').''); ?>
    
    				<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    				</div>
    				<?php thematic_postfooter(); ?>
    			</div><!-- .post -->
    <div class="post-container-bottom"></div>
    </div>

    But is not just that. I had to change so many things, like, for instance, the navigations DIVs position:

    <div id="container">
    		<div id="content">
    
    			<div id="nav-above" class="navigation">
                    <?php if(function_exists('wp_pagenavi')) { ?>
                    <?php wp_pagenavi(); ?>
                    <?php } else { ?>
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'thematic')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'thematic')) ?></div>
    				<?php } ?>
    			</div>

    And:

    <?php thematic_sidebar() ?>
    
    			<div id="nav-below" class="navigation">
                    <?php if(function_exists('wp_pagenavi')) { ?>
                    <?php wp_pagenavi(); ?>
                    <?php } else { ?>
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'thematic')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'thematic')) ?></div>
    				<?php } ?>
    			</div>
    
    <?php get_footer() ?>

    These things I don't think can be solved filtering functions, so as I had to change a lot, I've solved also my first issue.

    Posted 5 years ago #
  7. Ok... You're going the easy way by adding additional markup.

    About 2 years ago I wrote my first child theme "The Dark Side" for dKret3 which is based on the Sandbox markup too. I used graphics with rounded corners but without the need of additional markup. Takes more time but is definitely a 'cleaner' solution.

    Cheers,
    Chris

    Posted 5 years ago #
  8. Chris, I'm very curious to see how you managed to do the same. At the moment I don't see other solutions, but as you managed to do it without adding markups, there should be indeed something I miss :)

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.