• I like to use this plugin before the post content (without “Heading”) and end of the post with Heading. How do I do it?

    Apart from that is it possible to use bottom of the screen fixed sharing button only on mobile devices?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    For the first question, you will need to add some code to your website, either to your theme’s functions.php file or wherever you keep custom code. Make sure your files are backed up.

    First, go to the settings page and check the “After Content” setting for the post type you want to show buttons on, and set the heading as you like it.

    Then you will want to add the custom code to show the buttons before the post content without the heading:

    
    add_filter( 'the_content', 'prefix_scriptless_before_content' );
    /**
     * Add the social sharing buttons to the beginning of the content without the heading.
     *
     * @param string $content
     * @return string
     */
    function prefix_scriptless_before_content( $content ) {
    	if ( ! function_exists( 'scriptlesssocialsharing_do_buttons' ) ) {
    		return $content;
    	}
    	if ( 'post' !== get_post_type() ) {
    		return $content;
    	}
    
    	return scriptlesssocialsharing_do_buttons( false ) . $content;
    }
    

    (Using scriptlesssocialsharing_do_buttons with false as the argument will remove the heading.) This code example will work for posts–you will want to adjust it if you want to show buttons on other post types.

    To fix the buttons to the bottom of the screen on mobile would just require some custom CSS inside of a media query. This thread has some sample CSS which may help get you started, and then you would just have to wrap it in a media query for your desired mobile screen width.

    Thread Starter Bluemad

    (@bluemad)

    Thank you for your detail reply. One more thing, how do I adjust the space top and bottom.

    For the mobile banner, how do I specify the mobile device with? If you could, just give me an example.

    • This reply was modified 4 years, 6 months ago by Bluemad.
    Plugin Author Robin Cornett

    (@littlerchicken)

    Adjusting spacing would just be CSS–you could add padding or margin to the buttons container, or to the individual buttons. It would probably be easiest to use your browser’s dev tools to inspect the button container and experiment with adding padding or margin until you get the effect you would like, and then you can copy that CSS to your theme or to the Additional CSS panel.

    w3schools.com has a nice example of a media query for small screens which should be a helpful starting point.

    Thread Starter Bluemad

    (@bluemad)

    Thank you so much for your support. With this tutorial, I managed to add sticky widgets. (I added this link because it may be helping another person)

    https://www.w3schools.com/howto/howto_css_sticky_social_bar.asp

    Thread Starter Bluemad

    (@bluemad)

    Are there any way to run the above PHP code only on the screen resolution over 767px devices (less than 767px devices like to use floating sharing widget ) and add

    margin-top: 0px;

    only before post content widget?

    • This reply was modified 4 years, 6 months ago by Bluemad.
    Plugin Author Robin Cornett

    (@littlerchicken)

    PHP code is server side and isn’t reliable for detecting mobile v. desktop, or screen sizes. You can make CSS modifications like the margin based on screen size, though, by adding rules to the media query you’ve already created.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Different Heading words in different position possible?’ is closed to new replies.