im using some customer code found bellow to creat social

im using some customer code found bellow to creat social sharing on the following pages
http://www.lovedforever.org.uk/memorial/jade-stewart-2/#

theres two issues the first is that the social share for twitter is showing up with the comment or tibute but with html tags around it I need to remove these im not sure how I can do this

the second is on the face book share its sharing the
following it admin Jade stewart by admin admin being the name of the person who created the memorial or tribute it should read Jade stewart By admin so I need to figure out why its showing up the first admin and get rid of it please advise

<?php if( $the_query->have_posts() ): ?>

                              <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                                <div style='background:rgba(250, 250, 250, 0.5); margin-bottom:10px; padding:20px; border-radius: 10px; '>
                                    <div> <img height="70" width="70" src="http://www.lovedforever.org.uk/wp-content/uploads/2014/03/candel3.png"><?php the_time('F jS, Y') ?></div>
                                    <div><?php the_content(); ?> <br/>from <?php the_author(); ?>
                                    <?php $sharecontent=get_the_content($post_id);?>
                                    <div style="height:40px ; margin:5px; padding:0px;"  >
									<span style="float:right; overflow:hidden !important" >
									<?php  //echo do_shortcode('[ssba]');?>
                                    <div class="ssba">
<a class="ssba_twitter_share" href="http://twitter.com/share?url=http://www.lovedforever.org.uk/memorial/<?php echo get_the_title($post_id) ?>/&text=www.lovedforever.org.uk+www.lovedforever.org.uk/memorial/<?php echo get_the_title($post_id) ?>+<?php the_content(); ?>" target="_blank">
<img title="Twitter" class="ssba" alt="Tweet about this on Twitter" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/twitter.png">
</a>
<a class="ssba_facebook_share" href="https://www.facebook.com/dialog/feed?app_id=1407197776212391&display=popup&caption=In memory of <?php echo get_the_title($post_id).' by '. the_author(); ?>&link=<?php echo urlencode($URI); ?>&redirect_uri=<?php echo urlencode($URI); ?>&picture=<?php echo $pre_img[url];?>&description=<?php echo strip_tags($sharecontent); ?>" target="_blank">
<img title="Facebook" class="ssba" alt="Share on Facebook" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/facebook.png">
</a>
<a class="ssba_pinterest_share" href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">
<img title="Pinterest" class="ssba" alt="Pin on Pinterest" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/pinterest.png">
</a>
</div>
  • PC

    Hello there Jade,

    Thanks for posting on the forums.

    theres two issues the first is that the social share for twitter is showing up with the comment or tibute but with html tags around it I need to remove these im not sure how I can do this

    That text is being pulled in by <?php the_content(); ?>

    Can you kindly check and see if the content on the page has got any extra html tags (check via the text editor tab after editing the comment)

    the second is on the face book share its sharing the
    following it admin Jade stewart by admin admin being the name of the person who created the memorial or tribute it should read Jade stewart By admin so I need to figure out why its showing up the first admin and get rid of it please advise

    I am not able to see that in action, it seems like some error occurs whenever I try to share on facebook. Did you make any changes to the code after posting the thread ?

    Please advise.

    Cheers, PC

  • PC

    Hey there Jade,

    I am still not able to get the Facebook share working on my computer. So I have asked my colleague @Vinod Dalvi to have a look at this thread here.

    For the twitter share, the text is getting added by

    <?php echo $tribute ?>

    If you check your code, around line 849 it says

    <div class="description-memorial">
                            <h5>Tribute</h5>
                                    <p><?php echo $tribute ?></p>

    Change that from

    <p><?php echo $tribute ?></p>

    to

    <?php echo $tribute ?>

    and then try again to see if that works fine.

    Cheers, PC

  • Patrick

    Hi there @Jade

    I hope you are well today!

    Your issues can likely be resolved by fixing the HTML & PHP in your code. :slight_smile:

    You have several unclosed tags in there (3 divs on lines 4, 6 & 8, and a span on line 9), so you'd need to determine where to close them.

    Also, your loop has not been closed either. Try this modified code in your template:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    		<div style='background:rgba(250, 250, 250, 0.5); margin-bottom:10px; padding:20px; border-radius: 10px; '>
    			<div> <img height="70" width="70" src="http://www.lovedforever.org.uk/wp-content/uploads/2014/03/candel3.png"><?php the_time('F jS, Y') ?></div>
    			<div><?php the_content(); ?> <br/>from <?php the_author(); ?></div>
    		</div>
    <?php endwhile; endif; ?>
                                        <?php $sharecontent=get_the_content($post_id);?>
                                        <div style="height:40px ; margin:5px; padding:0px;"  >
    									<span style="float:right; overflow:hidden !important" >
    									<?php  //echo do_shortcode('[ssba]');?>
                                        <div class="ssba">
    <a class="ssba_twitter_share" href="http://twitter.com/share?url=http://www.lovedforever.org.uk/memorial/<?php echo get_the_title($post_id) ?>/&text=www.lovedforever.org.uk+www.lovedforever.org.uk/memorial/<?php echo get_the_title($post_id) ?>+<?php the_content(); ?>" target="_blank">
    <img title="Twitter" class="ssba" alt="Tweet about this on Twitter" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/twitter.png">
    </a>
    <a class="ssba_facebook_share" href="https://www.facebook.com/dialog/feed?app_id=1407197776212391&display=popup&caption=In memory of <?php echo get_the_title($post_id).' by '. the_author(); ?>&link=<?php echo urlencode($URI); ?>&redirect_uri=<?php echo urlencode($URI); ?>&picture=<?php echo $pre_img[url];?>&description=<?php echo strip_tags($sharecontent); ?>" target="_blank">
    <img title="Facebook" class="ssba" alt="Share on Facebook" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/facebook.png">
    </a>
    <a class="ssba_pinterest_share" href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">
    <img title="Pinterest" class="ssba" alt="Pin on Pinterest" src="http://www.lovedforever.org.uk/wp-content/plugins/simple-share-buttons-adder/buttons/simple/pinterest.png">
    </a>
    </div>
    </span>
    </div>

    It works on my test site here: http://rockysroad.info/sample-page/

    The Facebook button will throw an error though as it connects to your app and doesn't recognize my site.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.