Topic: FB Sharer from Masonry Brick | WP Masonry Layout

FB Sharer from Masonry Brick

Home Forums Lite Version FB Sharer from Masonry Brick

This topic contains 5 replies, has 2 voices, and was last updated by  Masonry Guy 1 year, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4930 Reply

    recordnj

    At http://www.rifref.com I’d like to share the actual url to the post versus the link to the page that the bricks are rendered. For example…

    http://rifref.com/chris-farley/chris-farley-4/ (actual post url) versus http://rifref.com/farley-chris/ (page that all bricks are rendered)

    Can you explain how to do that?

    share.php code…

    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = “//connect.facebook.net/en_US/all.js#xfbml=1″;
    fjs.parentNode.insertBefore(js, fjs);
    }(document, ‘script’, ‘facebook-jssdk’));

    <span id=”custom-fb-button”></span>

    Thanks!

    #4936 Reply

    Masonry Guy
    Keymaster

    Hi,

    That code comes from facebook and it auto detects the current page url and send it. As per your requirement, you need custom coded share url for it.

    Like ” class=”fb”>IMAGE GOES HERE

    Thanks

    #4946 Reply

    recordnj

    I have it working from facebook when the single.php renders a single post. However, all bricks point to the same page they are rendered on. In other words…

    The “Son of a!” brick on http://rifref.com/farley-chris/ (page for all bricks) facebook shares http://rifref.com/farley-chris/ (page for all bricks) when it should be sharing http://rifref.com/chris-farley/chris-farley-3/ (the single post for “Sun of a!”.

    How can I have the fb link in the brick point to the correct post?

    Thanks!

    #4970 Reply

    Masonry Guy
    Keymaster

    Hi,

    AS i previously stated above. It takes the url of the current page automatically. We don’t have any control in that code at all. However, you can write custom share url. Here is how to do that.

    <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" class="fb">Facebook</a>

    #4971 Reply

    recordnj

    I think, for me, it ended up being an issue with how WP parses php and html. This worked though…

    <?php $turl = get_permalink($post->ID);?>
    <span id=”custom-fb-button”>” data-send=”true” data-layout=”icon” class=”fb-share-button”></span>

    #4977 Reply

    Masonry Guy
    Keymaster

    Glad it is fine for your now.

    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: FB Sharer from Masonry Brick
Your information: