Pages?

  • Mod

    Kenneth John Odle

    #17656

    You can add them in using an action hook.

    raindance

    #17657

    http://sharethis.com/

    If you install the plug in then you get a settings page for it under settings in the WP dashboard. And it lets you adjust the html tags but not wrap them in divs that I can see.

    This is not crucial so if you are busy please don’t feel obliged πŸ™‚ You have been so helpful to me!

    Anonymous

    #17658

    I’m playing with it now. This is a tricky little sucker πŸ˜‰

    I’ll get back to you shortly.

    raindance

    #17659

    Ha, I agree. Thanks πŸ™‚

    Anonymous

    #17660

    Ok, instead of adding the plugin through WordPress, let’s just get the code for “website” instead. This will give you the html code and the script code. Then we can just insert it (using Ken’s suggestion above) with an action hook.

    So, on the sharethis site… instead of the default tab (toward the top) click “website” instead.

    raindance

    #17661

    Oh, good idea! Ok…so here is the code generated that way on the website tab…

    <span class=’st_twitter_hcount’ displayText=’Tweet’></span><span class=’st_facebook_hcount’ displayText=’Facebook’></span><span class=’st_fblike_hcount’ ></span><span class=’st_plusone_hcount’ ></span>

    <script type=”text/javascript”>var switchTo5x=true;</script><script type=”text/javascript” src=”http://w.sharethis.com/button/buttons.js”></script><script type=”text/javascript”>stLight.options({publisher:’a3fd7349-1e52-4dff-8567-b74f16e9be5c’});</script>

    now what? πŸ™‚

    Anonymous

    #17662

    Okay, where are you wanting to display this code? (Posts? Pages?)

    raindance

    #17663

    Both. But not the home page slider.

    At the bottom.

    Anonymous

    #17664

    Okay,

    I’m not quite sure how to keep it off the home page slider. I’d also like to know. Ken or Syahir, perhaps you can help πŸ™‚

    But, to get started…

    Wrap the first and last span tags, from the first part, in a div. ie.. <div id="sharethis"><span class='st_twitter_hcount' displayText='Tweet'></span><span class='st_facebook_hcount' displayText='Facebook'></span><span class='st_fblike_hcount' ></span><span class='st_plusone_hcount' ></span></div>

    Now, create a function in your child functions.php

    You can copy and paste the function below into your code (I made the adjustments for you personally. Just make sure you keep them consistent throughout. You should be able to copy and paste everything I posted here):

    function laura_sharethis (){
    ?>
    <div id="sharethis"><span class='st_twitter_hcount' displayText='Tweet'></span><span class='st_facebook_hcount' displayText='Facebook'></span><span class='st_fblike_hcount' ></span><span class='st_plusone_hcount' ></span></div>
    <?php
    }
    add_action( 'graphene_after_post_content', 'laura_sharethis' );

    1. We can name the function whatever we like, It needs to be the same as in the add_action code, which I’ll explain in a second.

    2. Note the div id, which we also custom named. This will match the css element we create in our child style.css

    3. The do_action and add_action work together as a “hook”. They are scattered all throughout the code. If you look in your graphene loop.php file, you will notice a little over halfway down, there is a <?php do_action('graphene_after_post_content'); ?> code. So, we want to tell it every time it sees do_action ( 'graphene_after_post_content' ) to automatically insert our do_action ( 'larua_sharethis' ) right afterwards. We “hook” it to the function.

    We are going to “hook” our function to this one. So, this is going to be the first part of our custom function add_action( resulting in this add_action( 'graphene_after_post_content', 'laura_sharethis' );.

    Lastly, create your css element in your child stlye.css file. Remember, this needs to match the div id we created earlier. So #sharethis { is what you want to use.

    Just add any properties you need in the css to position it where you like.

    Hope this all makes sense πŸ™‚

    raindance

    #17665

    You are very generous. Thanks I’ll give it a try!

Viewing 10 posts - 21 through 30 (of 63 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum