我想分享自定义帖子精选图片,标题和帖子文字的小内容。我怎样才能做到这一点?我尝试使用sharet这个WordPress插件,但它共享我的网站的标识和无用的内容。这是我的代码请帮帮我。
这是我的单一帖子代码:
<div class="row">
<!-- Sidebar -->
<aside class="col-sm-4 sidebar sidebar-right">
<?php require_once('template/advertisment/postview_side_advertisment.php'); ?>
<?php require_once('template/postview/side_recentpost.php'); ?>
</aside>
<!-- /Sidebar -->
<!-- Article main content -->
<article id="post-<?php the_ID(); ?>" class="col-lg-8 col-md-8 col-sm-12 col-xs-12 maincontent">
<?php
setPostViews(get_the_ID());
?>
<?php while (have_posts()) : the_post(); ?>
<h1 class="inner-page-header"><?php the_title(); ?></h1>
<h4>
<?php echo get_the_date("F j, Y g:i a", $post_id); ?>
</h4>
<h5><?php
echo getPostViews(get_the_ID());
?></h5>
<div class="social-sh col-lg-12 col-md-12 col-sm-12 col-xs-12">
<span class='st_facebook_large' st_title='<?php the_title(); ?>'
st_url='<?php the_permalink(); ?>'></span>
<span class='st_googleplus_large' st_title='<?php the_title(); ?>'
st_url='<?php the_permalink(); ?>'></span>
<span st_via='@saruwathlk' st_username='saruwathlk' class='st_twitter_large'
st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>'></span>
<span class='st_linkedin_large' st_title='<?php the_title(); ?>'
st_url='<?php the_permalink(); ?>'></span>
<span class='st_blogger_large' st_title='<?php the_title(); ?>'
st_url='<?php the_permalink(); ?>'></span>
<span class='st_flipboard_large' st_title='<?php the_title(); ?>'
st_url='<?php the_permalink(); ?>'></span>
</div>
<hr style="margin-top:9px; margin-bottom:0px">
<?php echo the_content(); ?>
<?php endwhile; // end of the loop. ?>
</article>
<?php echo the_title(); ?>
<?php echo the_permalink(); ?>
</div>
答案 0 :(得分:0)
要完成此操作,您需要在网站head
中设置开放图元标记。这篇文章对如何实现这一目标有很好的细分:https://www.elegantthemes.com/blog/tips-tricks/how-to-add-open-graph-tags-to-wordpress。