【问题标题】:Share Buttons Will Not Show分享按钮不会显示
【发布时间】:2013-01-28 23:09:29
【问题描述】:

我创建了一个自定义博客页面来配合我的 WordPress 网站。此页面仅显示博客提要的 1 个类别。我添加了“AddThis”插件分享按钮并在主题中手动编码。

问题是按钮不会显示。我已经尝试在页面中添加其他共享插件,但它们也不会显示。现在,这些按钮确实可以在其他博客页面和文章本身上显示。

这是网页的网址和代码,是我遗漏了什么还是需要更改一行代码?

Page with non-working share buttons

Page with working share buttons

<?php /* Template Name: Page - Online Reviews */ ?>
    <div class="main_container">
        <div class="page_container">


    <h2 style="border-bottom: solid thin #000; line-height: 50px; margin-bottom: 50px;"><?php the_title(); ?></h2>
    <?php
    $temp = $wp_query;
    $wp_query = NULL;
    $wp_query = new WP_Query();
    $wp_query->query('cat=4&paged='.$paged); $tb_counter = 1;
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <div <?php if(function_exists('post_class')) : ?><?php post_class(); ?><?php else : ?>class="post post-<?php the_ID(); ?>"<?php endif; ?>>
        <h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s','easycarebath'),the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h3>
            <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( '%s', 'easycarebath' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?></a>
            <?php the_content(); ?>
            <!-- AddThis Button BEGIN -->
            <div class="addthis_toolbox addthis_default_style ">
                <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
                <a class="addthis_button_tweet"></a>
                <a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
                <a class="addthis_button_linkedin_counter"></a>
                <a class="addthis_counter addthis_pill_style"></a>
            </div>
            <script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
            <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4dd51ec729a7fec7"></script>
            <!-- AddThis Button END -->
    <footer class="entry-meta">
    <?php the_time(__('M d, Y', 'easycarebath')); ?> | <?php _e('Categories:','easycarebath'); if (the_category(', '))  the_category(); ?> <?php if (get_the_tags()) the_tags(__('| Tags: ','easycarebath')); ?> | <?php comments_popup_link(__('Leave A Comment »', 'easycarebath'), __('1 Comment »', 'easycarebath'),__ngettext('% Comment »', '% Comments »',get_comments_number (),'easycarebath')); ?> <?php edit_post_link(__('Edit','easycarebath'), '| ', ''); ?>
    </footer>
    <?php $tb_counter++; endwhile; ?>
    <nav id="nav-below" class="navigation" role="navigation">
        <div class="nav-previous alignright"><?php next_posts_link(__('&laquo; Older Entries','easycarebath')); ?></div>
        <div class="nav-next alignleft"><?php previous_posts_link(__('Newer Entries &raquo;','easycarebath')); ?></div>
    </nav>
    <?php $wp_query = NULL; $wp_query = $temp;?>

        </div>
        <?php get_sidebar(); ?>
    </div>

【问题讨论】:

  • 你好像不见了get_footer()...
  • 我在代码中确实有 'get_footer()' 和 'get_header()' 所以它不会是那个。
  • 所有应该在&lt;head&gt; 标签内的内容似乎都在&lt;body&gt; 标签内。你把wp_head() 放对了吗?
  • 是的,我在 &lt;/head&gt; 之前有 wp_head();

标签: php html wordpress share share-button


【解决方案1】:

我发现了问题。问题不是代码,而是 Transmit 没有正确保存代码。重新启动程序后,我能够保存代码并且能够显示共享按钮。

感谢大家的尝试,这是软件问题。 :)

【讨论】:

    猜你喜欢
    • 2013-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-05
    相关资源
    最近更新 更多