【问题标题】:How do I add a Div button below the author name on posts?如何在帖子的作者姓名下方添加一个 Div 按钮?
【发布时间】:2014-11-20 16:19:23
【问题描述】:

我有按钮的 HTML。但我想把它放在每个帖子标题的底部。我在我的函数中找到了处理我的标题的区域,但显然有一种特殊的方法可以将按钮代码放入函数中,我无法弄清楚。希望你能帮助我,以下是所有信息:

--->我的按钮代码:

<div class="cb-tip-button" data-content-location="" data-href="//www.coinbase.com/tip_buttons/show_tip" data-to-user-id="52958dae01e73713d400002d"></div>
<script>!function(d,s,id) {var js,cjs=d.getElementsByTagName(s)[0],e=d.getElementById(id);if(e){return;}js=d.createElement(s);js.id=id;js.src="https://www.coinbase.com/assets/tips.js";cjs.parentNode.insertBefore(js,cjs);}(document, 'script', 'coinbase-tips');</script>

----> 这是我在该区域的主题功能。我强调了我认为它必须到期的部分: http://pastebin.com/XyB9yx1m

-----> 附件是我希望按钮外观的图片。

My image

【问题讨论】:

  • ?&gt;ADD CODE HERE&lt;/header&gt;&lt;!-- .entry-header --&gt; 只需将其放在关闭 php 标记之后和关闭 header 标记之前。您可能需要添加一些 css 来获得正确的填充和对齐

标签: php wordpress function button


【解决方案1】:

试试这个:

<header class="entry-header">
    <?php if (
        fearless_get_option( 'singular_featured_image_enabled' )
            && 'audio' != $format
            && 'gallery' != $format
            && 'video' != $format
        ) {
            fearless_post_thumbnail();
        }
    ?>

    <h1 class="entry-title"><?php single_post_title(); ?></h1>
    <?php
    printf(
        apply_atomic_shortcode(
            'entry_byline',
            '<div class="entry-byline">' . __( 'By [entry-author]   [entry-published]  ', 'fearless' ) . '</div>'
        ),
        sprintf(
            _n(
                '1 View',
                '%1$s Views',
                get_post_meta( get_the_ID(), 'Views', true ),
                'fearless'
            ),
            get_post_meta( get_the_ID(), 'Views', true )
        )
    );
    ?>
<div class="cb-tip-button" data-content-location="" data-href="//www.coinbase.com/tip_buttons/show_tip" data-to-user-id="52958dae01e73713d400002d"></div>
<script>!function(d,s,id) {var js,cjs=d.getElementsByTagName(s)[0],e=d.getElementById(id);if(e){return;}js=d.createElement(s);js.id=id;js.src="https://www.coinbase.com/assets/tips.js";cjs.parentNode.insertBefore(js,cjs);}(document, 'script', 'coinbase-tips');</script>
</header><!-- .entry-header -->

现在应该添加到标题中。

它只需要在结尾&lt;/header&gt;标签之上。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-09
    • 1970-01-01
    • 1970-01-01
    • 2013-03-05
    • 2015-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多