如何在entry-meta和entry-content之间的genesis主题中添加自定义html

时间:2016-10-22 18:46:21

标签: wordpress genesis

我想知道如何在帖子页面中的entry-meta和entry-content之间的genesis模板中添加自定义html代码。

感谢。

2 个答案:

答案 0 :(得分:0)

使用genesis_entry_header操作。这允许您将内容注入标题的末尾。

add_action( 'genesis_entry_header', 'add_stuff_after_title', 12 );
function add_stuff_after_title() {
    if(is_singular('post')) {
        _e("<span>This is before the ending header tag.</span>");
    }
}

答案 1 :(得分:0)

这是关闭标题的起源代码

add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
/**
 * Echo the closing structural markup for the entry header.
 *
 * @since 2.0.0
 */
function genesis_entry_header_markup_close() {
    echo '</header>';
}

优先级为15,并且我的代码的优先级必须更高

add_action( 'genesis_entry_header', 'add_stuff_after_title', 100 );
function add_stuff_after_title() {
    if(is_singular('post')) {
        _e("<span>This is before the ending header tag.</span>");
    }
}