WordPress.org

Support

Support » Plugins and Hacks » Post Share Count » [Resolved] Add the buttons via functions?

[Resolved] Add the buttons via functions?

  • Hello, asked you a while back about how to include @via in the tweet, since then I changed my theme and now I’m using a Genesis like framework( to be honest lots of functionality is similar if not the same) and I have to put my custom stuff using functions.php like this

    add_action( 'omega_after_entry', 'omega_entry_footer' );
    function ...etc

    How do I add your sharing code in a theme functions file? I don’t know too much about this and I’m stuck in all that <?php thing and I don’t add it correctly. I’m ashamed about my noobiness but I need this and it gives me a lot of headaches 🙁
    Thanks!

    https://wordpress.org/plugins/post-share-count/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author zviryatko

    @zviryatko

    Hello

    Documentation for genesis framework only for members =(
    But it’s not a big problem =)

    If you need to just display social link I hope this can help (add to your child theme functions.php)

    add_action( 'omega_after_entry', 'your_child_theme_name_omega_entry_footer_action' );
    
    function your_child_theme_name_omega_entry_footer_action() {
      the_post_share_count();
    }

    If you need more help with wordpress actions/filters and php you can write to me by email, or GTalk, to sanya.davyskiba@gmail.com

    Dude, it’s not Genesis, it only looks like it. You can fiind Omega framework even on wordpress.org.

    BTW, thanks! It worked like a charm but … the links have no classes. ?!

    LE: I found it. Now they have classes because based on your reply and the suggested codes in the info I know now how things work, how to add stuff in the functions file. 😀

    Plugin Author zviryatko

    @zviryatko

    I’m glad it helped 😀

    Uh, one more thing if I( hope)’m not annoyng. Finally used the code like this `function share_count() {
    $share_args = array(
    ‘before_twitter’ => ”,
    ‘after_twitter’ => ”,
    ‘before_facebook’ => ”,
    …etc`
    How do I mix it( if i can) with this $args = array('show_only' => array( 'twitter', 'facebook' )); to limit the number of displayed networks?

    I want to keep things as simple as I can with my theme so I used a small function to call only the wordpress Dashicons from the backend in case I need some and they have only twitter, gplus and facebook icons.

    Plugin Author zviryatko

    @zviryatko

    All $args is one array, just merge it together

    $share_args = array(
      'before_twitter' => '',
      'after_twitter' => '',
      'show_only' => array('twitter'),
    );
    //...

    Done that but it doesn’t work > blogshot .ro

    Oh yes it does. I was looking only at my first post that probably had a caching issue or something. Thanks again!

    Plugin Author zviryatko

    @zviryatko

    Post please all your added code

    Here it is, just what you told me and it works now. The last problem was just a caching issue of my blog.

    add_action( 'omega_after_entry', 'share_count' );
    
    function share_count() {
      $share_args = array(
    
        'before_twitter' => '<ul class="share"><li class="share-twitter"><span class="share-t"><a href="https://twitter.com/intent/tweet?text=' . urlencode(get_the_title()) . '&url=' . urlencode(get_permalink()) . '&via=' . urlencode('cartonic') . '" rel="nofollow" target="_blank"> ',
        'after_twitter' => '</a></span></li>',
    
        'before_facebook' => '<li class="share-facebook"><span class="share-f"><a href="https://www.facebook.com/sharer/sharer.php?u=%url%" rel="nofollow" target="_blank"> ',
        'after_facebook' => '</a></span></li>',
    
        'before_googleplus' => '<li class="share-googleplus"><span class="share-g"><a href="https://plus.google.com/share?url=%url%" rel="nofollow" target="_blank"> ',
        'after_googleplus' => '</a></span></li></ul>',
    
        'show_only' => array('twitter','facebook','googleplus'),
    );
    
    the_post_share_count( $share_args );
    
    }

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Add the buttons via functions?’ is closed to new replies.
Skip to toolbar