Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1232721
    nicomorgan
    Participant

    Have searched for this answer and found similar-but-not-quite-right solutions…

    What I’m after is a row of social share icons for each blog post ON THE BLOG HOME page, just like Integrity already offers for the Portfolio page.

    More specifically I have already added social sharing to the individual posts but would like the blog home page to show blog posts in the masonry style (already set up) with image, title and excerpt and “read more” links then followed by the social share icons.

    I see that in the portfolio home page it invokes a function called x_portfolio_item_social which I found in framework/functions/global/portfolio.php. Is it possible to invoke that function from within the code which creates the blog home page so that the links share the individual post, not the blog home page itself? If so, where would I do this?

    Thanks in advance.

    equiratings.com (blog page is Features, portfolio is Previews)

    #1232746
    Rad
    Moderator

    Hi there,

    Thanks for posting in.

    That’s possible, but not the exact code as the portfolio. Please add this code to your child theme’s functions.php

    function x_post_item_social() {
    
      $enable_facebook = $enable_twitter = $enable_google_plus = $enable_linkedin = $enable_pinterest = $enable_reddit = $enable_email = true;
    
      $share_url     = urlencode( get_permalink() );
      $share_title   = urlencode( get_the_title() );
      $share_source  = urlencode( get_bloginfo( 'name' ) );
      $share_content = urlencode( get_the_excerpt() );
      $share_image   = urlencode( x_get_featured_image_with_fallback_url() );
    
      $facebook    = ( $enable_facebook == '1' )    ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on Facebook', '__x__' ) . "\" onclick=\"window.open('http://www.facebook.com/sharer.php?u={$share_url}&t={$share_title}', 'popupFacebook', 'width=650, height=270, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-facebook-square\" data-x-icon=\"\"></i></a>" : '';
      $twitter     = ( $enable_twitter == '1' )     ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on Twitter', '__x__' ) . "\" onclick=\"window.open('https://twitter.com/intent/tweet?text={$share_title}&url={$share_url}', 'popupTwitter', 'width=500, height=370, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-twitter-square\" data-x-icon=\"\"></i></a>" : '';
      $google_plus = ( $enable_google_plus == '1' ) ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on Google+', '__x__' ) . "\" onclick=\"window.open('https://plus.google.com/share?url={$share_url}', 'popupGooglePlus', 'width=650, height=226, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"\"></i></a>" : '';
      $linkedin    = ( $enable_linkedin == '1' )    ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on LinkedIn', '__x__' ) . "\" onclick=\"window.open('http://www.linkedin.com/shareArticle?mini=true&url={$share_url}&title={$share_title}&summary={$share_content}&source={$share_source}', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-linkedin-square\" data-x-icon=\"\"></i></a>" : '';
      $pinterest   = ( $enable_pinterest == '1' )   ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on Pinterest', '__x__' ) . "\" onclick=\"window.open('http://pinterest.com/pin/create/button/?url={$share_url}&media={$share_image}&description={$share_title}', 'popupPinterest', 'width=750, height=265, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-pinterest-square\" data-x-icon=\"\"></i></a>" : '';
      $reddit      = ( $enable_reddit == '1' )      ? "<a href=\"#share\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share\" title=\"" . __( 'Share on Reddit', '__x__' ) . "\" onclick=\"window.open('http://www.reddit.com/submit?url={$share_url}', 'popupReddit', 'width=875, height=450, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-reddit-square\" data-x-icon=\"\"></i></a>" : '';
      $email       = ( $enable_email == '1' )       ? "<a href=\"mailto:?subject=" . urlencode( get_the_title() ) . "&body=" . urlencode( __( 'Hey, thought you might enjoy this! Check it out when you have a chance:', '__x__' ) ) . " " . get_permalink() . "\" data-toggle=\"tooltip\" data-placement=\"bottom\" data-trigger=\"hover\" class=\"x-share email\" title=\"" . __( 'Share via Email', '__x__' ) . "\"><span><i class=\"x-icon-envelope-square\" data-x-icon=\"\"></i></span></a>" : '';
    
        ?>
    
        <div class="x-entry-share man">
          <div class="x-share-options">
            <?php echo $facebook . $twitter . $google_plus . $linkedin . $pinterest . $reddit . urldecode( $email ); ?>
          </div>
        </div>
    
        <?php
    
    }
    
    add_actio('x_before_view_integrity__content-post-footer', 'the_static_banner');
    
    function the_static_banner () {
    
    x_post_item_social();
    
    }
    

    Hope this helps.

    #1233586
    nicomorgan
    Participant

    Should that be add_action{… towards the end?

    Do I need to alter or change anything else?

    #1233594
    nicomorgan
    Participant

    (I got it to work after changing the actio to action.)

    Is it possible to have these icons included in the white boundary box of the post?

    #1233916
    Jade
    Moderator

    Hi there,

    Please add this code in the customizer:

    .blog .x-entry-share.man {
        background-color: #fff;
        box-shadow: 0 0.15em 0.25em 0 rgba(0,0,0,0.135);
        border-radius: 0 0 4px 4px;
        position: relative;
        top: -5px;
    }
    
    .blog .entry-wrap {
        border-radius: 0;
    }

    Hope this helps.

    #1234373
    nicomorgan
    Participant

    Spot on! Thank you!

    #1234437
    Friech
    Moderator

    You’re more than welcome, glad we could help.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1232721 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>