ThemeShaper Forums » Thematic

[closed]

Sociable

(9 posts)
  • Started 4 years ago by brongracz
  • Latest reply from em hr
  • This topic is not resolved
  1. How to add Sociable plugin function code to Thematic templates.
    By default sociable comes as appended to an entry content witch makes it difficult to flexibly style it. It should come on the same level as post meta etc.

    Posted 4 years ago #
  2. In other words can I put it in some hook that will display it under my entry content and not in it as it is by default?

    Posted 4 years ago #
  3. thematic_postfooter() - Ok I know it is there, but I would like my sociable to appear first in it. Then date, and than standard stuff like tags and comments. Any ideas?

    Posted 4 years ago #
  4. Hey great thematic community!

    Posted 4 years ago #
  5. Hey I answered 2 questions here. Do I deserve an answer?

    Posted 4 years ago #
  6. Hi brongracz,

    I hear your need for a reply and I commend your helping in the forums :) Keep up the good work. Thanks it's much appreciated by all.

    I'm in the middle of something at the moment that is keeping me from testing this but will have something for you in a bit.

    Cheers,
    Gene

    Posted 4 years ago #
  7. This will put it after the entry-content but before the entry-utility Try this in your child theme's functions.php

    function child_sociable($thematic_output){
    	if (function_exists('sociable_html')) {
        	$soc_links = sociable_html();
    	}
    	return $soc_links . $thematic_output;
    
    }
    add_filter('thematic_postfooter','child_sociable');

    You'll need to uncheck the "Position" options in Sociable section of the wp-admin. Now this will output on every template that calls thematic_postfooter() so you may need to use some conditional tags to get it to display only where you want it. This may not be exactly what you want but hopefully it leads the way.

    Good Luck-
    Gene

    Posted 4 years ago #
  8. I will use the favorite expression of this forum - worked like a charm!!!

    I do not understand the code though. I will guess a bit...

    So we set a function which is / has ? a variable $thematic_output. If there exists fuction sociable_html we create a var $soc_links which is the the sociable_html function. At the end we return it. What is the dot . ? Our soc_links is in class of $thematic_output?

    I don't know the syntax of php so well, or at all :)

    Posted 4 years ago #
  9. No classes... only variables. What we've done here is created a filter function thus the add_filter() part .

    Our function is taking the output of the thematic_postfooter() as seen here:
    function child_sociable($thematic_output)
    and creating a new string that concatenates the sociable function output and the thematic function output.

    The "." is the concatenation operator used to combine the two variables $soc_link and $thematic_output.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.