• Resolved cag8f

    (@cag8f)


    Hello. Great theme, and thank you for the support.

    I am attempting to insert sharing icons (produced by the Jetpack plugin) onto each page. By default they are displayed at the bottom of each page, but the devs have written instructions on how to insert them anywhere on the page (https://jetpack.me/2013/06/10/moving-sharing-icons/). Specifically, one has to insert some PHP code somewhere:

    if ( function_exists( 'sharing_display' ) ) {
        sharing_display( '', true );
    }
    
    if ( class_exists( 'Jetpack_Likes' ) ) {
        $custom_likes = new Jetpack_Likes;
        echo $custom_likes->post_likes( '' );
    }

    (there is also code to be inserted into functions.php, but that is straightforward) This code must be inserted, “…in the area you want the Sharing or Likes buttons to appear.” But I’m not sure exactly where this should be inserted. Again, I would like to insert these icons on each page, on the same line as my page title, and right aligned. So in what file(s) should I include this code, and where exactly?

    Thanks in advance.

    PS: There is also a method to carry this out using jQuery, but that is a little beyond my expertise.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi cag8f,

    If you want to display it next to the post title on single posts, you’ll need to paste the code between line 65 and 67 in single.php. You’ll also need to make some CSS additions for it to work properly.

    Paste it in the equivalent place (between .post-title and .post-meta) in content.php, content-aside.php, content-video.php and content-quote.php if you want it to appear in the archives and search results.

    Thread Starter cag8f

    (@cag8f)

    Thanks so much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where to insert PHP code for sharing icons’ is closed to new replies.