当我尝试将其插入WordPress单个帖子模板content-single.php
时,不显示facebook like按钮。实际上facebook喜欢按钮标记正在加载网页源代码,但由于某种原因按钮没有显示。如果我在post循环之前或之后放置按钮代码都可以。知道我如何在content-single.php
模板中获取类似按钮以显示(如果可能),而不是使用jQuery?
<div class="fb-like" data-href="<?php the_permalink() ?>" data-width="200" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
应从content-single.php
模板内部调用上述内容:
<div id="content">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php comments_template( '/article-comments.php' ); ?>
<?php endwhile; ?>
</div>
编辑:
content-single.php
的基本内容是:
<div class="featuredImage" style="clear:both;float:left;">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('thumb-400');
}
?>
</div>
<div class="caption">
<?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?>
</div>
<div class="single-entry-content" style="width:70%;float:left">
<p class="summary"><?php echo get_post_meta($post->ID, 'entry', true);?></p>
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'yoko' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit →', 'yoko' ), '| <span class="edit-link">', '</span>' ); ?>
</div>
此文件中还包含一个相关文章侧边栏,其中多次调用wp_get_object_terms
函数。