ThemeShaper Forums » Thematic

[closed]

horizontal social buttons under post title.

(8 posts)
  • Started 7 years ago by Dust
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Dust
    Member

    Hi
    I found only one plugin that does this but I get errors and cache problems with it and decides to delete from my blog. I ended up just getting the code from Google+ and Tweeter, and Facebook and put it into a text widget that is in the Single Bottom widget area of Thematic. It is ok but I would really like to have the social buttons under every post title. Does anyone know how I could do this? Thanks in advance.

    Posted 7 years ago #
  2. Dust
    Member

    helgatheviking
    Thank you for replying. I was hoping to find a tutorial on how to do it. I have no knowledge of php so the filter tutorial kinda goes over my head.

    Posted 7 years ago #
  3. umm that IS the tutorial in the most general sense, b/c as i said in that post... the process is the same almost no matter what you want to do. if you genuinely read it (versus skimmed over it as soon as you saw a php function) then i would appreciate knowing what you find so confusing, so that i can improve my tutorial. i tried to break it down to its most elemental parts and used what i thought was a pretty good analogy.

    you WILL have to get SOME knowledge of PHP if you expect to be able to do anything w/ your theme.

    Posted 7 years ago #
  4. fwunder
    Member

    Bellying up to the social bar...

    I don't possess nearly the awesomeness of Ms. Viking, but as I am learning Thematic, I decided to play in my sandpit this morning with the horizontal social bar stuff and placement. Like she said, "Thematic Trix are for kids, with SOME PHP knowledge." In addition to this excellent resource, Google is your friend.

    First thing I did was create a social.php file that I could play with till I got it the way I wanted it:

    <? php
    <div id="social_bar">
    <!-- Facebook Like code -->
    <!-- Google button -->
    <!-- Twitter button -->
    </div>
    ?>

    Happy with that, I needed to decide where to put it. I played with several different areas using http://visualizing.thematic4you.com/2008/09/layout-test/ as my guide. For example, I tried:

    function social_bar() {
        include(STYLESHEETPATH . '/includes/social.php');
    }
    add_action('thematic_abovepost','social_bar');

    Note that I created an "includes" directory in my child theme just to keep all my sandpit toys in order. Using includes makes my function.php file easier for me to read too. I get confused easily. Anyway, I didn't like any of the places I found on the map. I wanted it in my menu bar space - access div. A little Googling and browsing http://thematic4you.com/ I found what I was looking for.

    Basically, I needed to remove the access menu and and replace it with the menu AND my social bar. Cool.

    //remove access menu so we can build a new one with social bar
    function remove_thematic_actions() {
        remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_actions');
    
    // Create a custom access div with the menu and social bar
    function social_access() { ?>
        	<div id="access">
        		<?php
    	    		if ((function_exists("has_nav_menu")) && (has_nav_menu(apply_filters('thematic_primary_menu_id', 'primary-menu')))) {
    	    			echo  wp_nav_menu(thematic_nav_menu_args());
        			} else {
        				echo  thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));
        			}
    	    	?>
    
    			<?php include(STYLESHEETPATH . '/includes/social.php'); ?>
    
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','social_access',9);

    You'll see how it looks @ http://www.timwunderlich.com/
    It looks pretty good in everything but IE7. I need to Google some more on the CSS stuff. Not sure if this helps you, but it helps me writing it up - repetitive motion thing. Have fun!

    Posted 7 years ago #
  5. IE7 can slough off and die. ;)

    fwunder, if you don't want to create a separate file you could just put the html in your function (if you are using a newer thematic you can skip straight to using an override without needing to remove and add actions

    // Create a custom access div with the menu and social bar
    function childtheme_override_access() { ?>
        	<div id="access">
        		<?php
    	    		if ((function_exists("has_nav_menu")) && (has_nav_menu(apply_filters('thematic_primary_menu_id', 'primary-menu')))) {
    	    			echo  wp_nav_menu(thematic_nav_menu_args());
        			} else {
        				echo  thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));
        			}
    	    	?>
    
    			<div id="socialstuff">I heart bacon</div>
    
            </div><!-- #access -->
    <?php }

    also, i'm getting away from using include in favor of locate_template() as it doesn't break things if it doesn't find the file.

    http://codex.wordpress.org/Function_Reference/locate_template

    locate_template('includes/social.php',true);
    Posted 7 years ago #
  6. fwunder
    Member

    Somehow I knew you would come up with a better way! :)

    Thanks!

    Posted 7 years ago #
  7. not always better, just different. i do like locate_template though. it is pretty bad-ass as far as functions go.

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.