We're merging with GenerateBlocks! Learn more here.

[Resolved] Add Social to post pages only

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Add Social to post pages only

Tagged: 

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #23198
    Jennifer
    Participant

    Hello,

    I just purchased your pro plugin, love it by the way, and was wanting to know is there a way to add a hook to show only the social media part?

    I have this plugin and your Generatepress Lifetime Theme.

    I like how you coded it and is very lightweight. I like that it has a heart and no thumbs down.

    Okay can you please let me know if we can add the social media part only to our post pages.

    Thank you

    #23207
    Jennifer
    Participant

    Let me explain a little better. I have the pro WP Show Post plugin. Within that plugin you can add social media to your WP Show Post. What I would like to know is since you created a lightweight social media section for WP Show Post is there a way to add this social media part only to Post pages globally using a hook?

    https://livinghisword.org/wp-content/uploads/2020/11/wpshowpost1.png
    https://livinghisword.org/wp-content/uploads/2020/11/wpshowpost2.png
    https://livinghisword.org/wp-content/uploads/2020/11/wpshowpost3.png

    This would be a great addition to our post pages.

    #23319
    Jennifer
    Participant

    Hi there,

    Was just wondering if my question was okay to ask or your thinking about it or this is not possible, any feedback would be great, thank you :).

    #23404
    elvin
    Moderator

    Hi,

    My apologies for the response delay.

    What I would like to know is since you created a lightweight social media section for WP Show Post is there a way to add this social media part only to Post pages globally using a hook?

    You can definitely place your own markup or lightweight social media shortcodes using the wpsp_after_content hook.

    Example:

    add_filter( 'after_setup_theme', function(){
    	remove_action( 'wpsp_after_content', 'wpsp_add_social_sharing', 10 );
    	add_action( 'wpsp_after_content', function(){
    		// do your thing here example: do_shortcode('[social_icon_widget_plugin_shortcode"]'); or echo get_field('sample_custom_acf_field');
    	}, 10 );
    });

    What this does is it removes the default social icons and replaces it w/ an action hooking whatever you add within the add_action( 'wpsp_after_content', function(){ // do something here });.

    #23462
    Jennifer
    Participant

    Hi there,

    Thank you for the reply and for the help. However, I don’t want to replace social media on the post page I want to add the WP Show Post social media on the post page. Can you provide the shortcode to add wpsp_add_social_sharing.

    You provided on how to remove it so can you provide one on how to add it?

    Thank you

    #23540
    Tom
    Keymaster

    Hi there,

    WPSP wasn’t built to affect single post templates. You’re definitely better off using a social sharing plugin that’s meant to do this.

    However, if you want to use the WPSP code, you could try hooking it into your theme, depending on whether they have hooks available. In GP, you could try this:

    add_action( 'generate_after_content', function() {
        if ( ! is_single() ) {
            return;
        }
    
        // order of args: ID, Twitter, Facebook, Pinterest, Love, alignment.
        echo wpsp_social_sharing( get_the_ID(), true, true, true, true, 'left' );
    } );

    Again, this is telling WPSP to do something it wasn’t built to do, so not 100% sure it will work, but the idea is there 🙂

    #23563
    Jennifer
    Participant

    Okay this great and were almost there. Do you think you could help me a little further. By the way I do have Generatepress Pro.

    I added the code you provided to my functions.php file. The love number is showing but nothing else, however the code is there. Any reason why it is not showing up?

    https://livinghisword.org/wp-content/uploads/2020/12/WPSHOWpost1.png
    https://livinghisword.org/wp-content/uploads/2020/12/WPSHOWpost2.png

    So close :)!

    Thanks Tom

    #23565
    Jennifer
    Participant

    The code is the same when adding the social to the WP Show Post. So hmmmm!

    https://livinghisword.org/wp-content/uploads/2020/12/WPSHOWpost3.png

    #23567
    Jennifer
    Participant

    Okay the code is the same but it is missing the ::before code. How do you add this so the social icons show up?

    https://livinghisword.org/wp-content/uploads/2020/12/WPSHOWpost4.png
    https://livinghisword.org/wp-content/uploads/2020/12/WPSHOWpost5.png

    #23653
    Tom
    Keymaster

    Hmm, so the CSS isn’t being generated on that page.

    Any chance you can link me to it?

    #23673
    Jennifer
    Participant

    Sure, how do I provide the sensitive information?

    Oh and it is not just this one particular page. It is for all post pages.

    #23761
    elvin
    Moderator

    Hi,

    Sure, how do I provide the sensitive information?

    Oh and it is not just this one particular page. It is for all post pages.

    You can send your details here:
    https://wpshowposts.com/contact/

    Please include the link to this topic on your message. Thank you.

    #23837
    Jennifer
    Participant

    Okay I just emailed you the credentials, thank you again.

    #23935
    Tom
    Keymaster

    Hmm yea, this is what I feared, unfortunately. None of the styles are loading as they’re built to only load when the post list is loaded.

    In this case, it’s best to have a separate solution for single posts, unfortunately.

    Sorry I can’t be more helpful!

    #24065
    Jennifer
    Participant

    Okay thank you for trying to help me. Is there a way to add my own social media using a hook within your WPShow Post section? Or can I add my own to your WP Show Post?

    By the way I do have Generatepress Pro version.

    Here is the code

    <?php 
    
    $postUrl = 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; ?>
    
    <section class="share_wrapper">
        <div style="font-size:28px;font-style: italic;color:#cf686f">Share The Love Of Christ</div>
        <div class="shareBTN">
            <a target="_blank" href="https://twitter.com/intent/tweet?url=<?php echo $postUrl; ?>&text=<?php echo the_title(); ?>&via=<?php the_author_meta( 'twitter' ); ?>" title="Tweet this"><img src="https://livinghisword.org/wp-content/uploads/2020/03/twitter.png" alt="twitter" class="ShareBTN"></a>
            <a target="_blank"  href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $postUrl; ?>" title="Share on Facebook"><img src="https://livinghisword.org/wp-content/uploads/2020/07/facebook.png" alt="facebook" class="ShareBTN"></a>
            <a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $postUrl; ?>&title=<?php echo the_title(); ?>" title="Share on LinkedIn"><img src="https://livinghisword.org/wp-content/uploads/2020/03/linkedin.png" alt="linkedin" class="ShareBTN"></a>
    			<a target="_blank" href="https://pinterest.com/pin/create/button/?url=<?php echo $postUrl; ?>&title=<?php echo the_title(); ?>" title="Share on pinterest"><img src="https://livinghisword.org/wp-content/uploads/2020/03/pinterest.png" alt="pinterest" class="ShareBTN"></a>
    			<!-- LikeBtn.com BEGIN -->
    <span id="likeBUTTON" class="likebtn-wrapper" data-theme="custom" data-btn_size="70" data-f_size="18" data-icon_size="0" data-icon_l_url="https://livinghisword.org/wp-content/uploads/2020/11/heart-iconmonstr-64.png" data-icon_l_url_v="https://livinghisword.org/wp-content/uploads/2020/11/heart-after-iconmonstr-64.png" data-icon_d_url_v="https://livinghisword.org/wp-content/uploads/2020/11/heart-after-iconmonstr-64.png" data-label_c="#800000" data-label_c_v="#e07334" data-counter_l_c="#2a2a2a" data-bg_c="#ffffff" data-bg_c_v="#ffffff" data-brdr_c="#ffffff" data-label_fs="r" data-i18n_like="Like" data-white_label="true" data-rich_snippet="true" data-dislike_enabled="false" data-icon_dislike_show="false" data-voting_frequency="600" data-counter_clickable="true" data-counter_frmt="comma" data-popup_disabled="true" data-share_enabled="false" data-lazy_load="true" data-loader_show="true" data-i18n_after_like="Like" data-i18n_like_tooltip="Liked This Teaching!" data-i18n_unlike_tooltip="Thank you for sharing!" data-i18n_share_text="Thank you for liking this teaching please close this box."></span>
    <script>(function(d,e,s){if(d.getElementById("likebtn_wjs"))return;a=d.createElement(e);m=d.getElementsByTagName(e)[0];a.async=1;a.id="likebtn_wjs";a.src=s;m.parentNode.insertBefore(a, m)})(document,"script","//w.likebtn.com/js/w/widget.js");</script>
    <!-- LikeBtn.com END -->
        </div>
    
    </section>

    What yours looks like
    https://livinghisword.org/wp-content/uploads/2020/11/wpshowpost1.png

    I would like to add my own instead of yours, please
    https://livinghisword.org/wp-content/uploads/2020/12/wpshowpost.png

    Thank you for your time 🙂

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.