ThemeShaper Forums » Thematic

[closed]

Add Sharethis to postmeta

(8 posts)
  • Started 4 years ago by jhodgson
  • Latest reply from freedimensional
  • This topic is resolved
  1. I'm trying to add a link to the postmeta links. Here's what I added:

    function childtheme_sharethis($content) {   $content .= "test";
       return $content;
    }
    add_filter('thematic_postfooter','childtheme_sharethis');

    This works, but it adds the "Test" link on a separate line. I want it to be on the same line with "Posted in Snarky Invective | Leave a comment | Edit"

    Am I filtering the wrong thing? Thanks!

    Posted 4 years ago #
  2. Hi,

    try this one:

    function childtheme_sharethis($content) {
    	$content = str_replace('</div>', 'test' . "\n" . '</div>', $content);
    	return $content;
    }
    add_filter('thematic_postfooter','childtheme_sharethis');

    Chris

    Posted 4 years ago #
  3. Hi Chris,

    This works great!

    How do I then add template tags to this?
    I'm having difficulty with syntax errors, but here's what I'm hoping to achieve:

    function childtheme_sharethis($content) {
    	$content = str_replace('</div>', '<?php if (function_exists('tweetmeme')) echo tweetmeme();?>
    <?php if (function_exists('fbshare_manual')) echo fbshare_manual();?>' . "\n" . '</div>', $content);
    	return $content;
    }
    add_filter('thematic_postfooter','childtheme_sharethis');

    Yours,
    Tom

    Posted 4 years ago #
  4. Actually, looking at another of Chris's postings, the below looks like it's along the right lines:

    function childtheme_sharethis($content) {
      $content = <?php if (function_exists('tweetmeme')) echo tweetmeme();?> ;
      $content = <?php if (function_exists('fbshare_manual')) echo fbshare_manual();?> ;
      return $content;}
    add_filter('thematic_postheader', 'childtheme_sharethis');

    What am I doing wrong?

    Tom

    Posted 4 years ago #
  5. That won't work :)

    Will be back home in approx. 2h. Then I'll look into this.

    Chris

    Posted 4 years ago #
  6. Amazing - thank you Chris!

    Ideally, the end result would be as follows:

    [Post Title]
    By [Author] | Published: [Date] | [tweetmeme] | [fbshare_manual] [| edit - when logged in]

    Yours,
    Tom

    Posted 4 years ago #
  7. OK .. first of all you need to get a SVN copy of Thematic.

    Sorry for this, but I'm too lazy to rewrite the whole code :)

    Then try this one:

    function my_postmeta() {
        $postmeta = '<div class="entry-meta">';
        $postmeta .= thematic_postmeta_authorlink();
        $postmeta .= '<span class="meta-sep meta-sep-entry-date"> | </span>';
        $postmeta .= thematic_postmeta_entrydate();
    	if (function_exists('tweetmeme')) {
    		$postmeta .= ' <span class="meta-sep meta-sep-tweetmeme">|</span> ' . '<span class="tweetmeme">' . tweetmeme() . '</span>';
    	}
        if (function_exists('fbshare_manual')) {
    		$postmeta .= ' <span class="meta-sep meta-sep-fbshare">|</span> ' . '<span class="fbshare">' . fbshare_manual() . '</span>';
    	}
        $postmeta .= thematic_postmeta_editlink();
    
        $postmeta .= "</div><!-- .entry-meta -->\n";
    
        return $postmeta;
    }
    add_filter('thematic_postheader_postmeta', 'my_postmeta');

    The code itself is working. I can't tell you if the buttons will work and if the markup is the right one.

    Chris

    Posted 4 years ago #
  8. Wow - Chris, are you from another dimension?!
    This works great, once the styles are added in to flavour.

    I've got it looking almost exactly as I want it, except for one bit of styling that I can't for the life of me achieve: moving the tweet button down three pixels.

    Any suggestions? Please let me know!
    Check it out at http://digitalcortex.net

    Tom

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.