如何为创世纪子主题移动页面标题而不是帖子标题 [英] How to move a Page title but not a Post title for a Genesis child theme
问题描述
我问Studio Press支持人员如何将页面标题移至Genesis框架的其他部分.他们回答了以下代码:
I asked Studio Press support how to move the page title to a different section of the Genesis framework. They replied with code:
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_open', 11 );
add_action( 'genesis_after_header', 'genesis_do_post_title', 12 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_close', 13 );
这有一个问题,因为它同时移动了页面标题和帖子标题.这意味着在博客页面上,帖子标题移至页面标题的位置,帖子标题具有页面标题,例如新闻".
There's a problem with this, in that it moves both Page titles and Post titles. This means on the Blog page, the Post title is moved into the position of the Page title, and the Post title has the Page title e.g. "News".
我的问题是:如何使用remove_action
/add_action
...仅移动Page标题,而不移动Post标题?
My question is: how do I move just the Page title, and not the Post title, using remove_action
/ add_action
...?
帮助表示赞赏.
推荐答案
您有2个选择:
- You can use the code in functions.php with a conditional tag like is_singular('page') See this tutorial
Or add the code to a page.php template file with a opening PHP tag like this:
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_open', 11 );
add_action( 'genesis_after_header', 'genesis_do_post_title', 12 );
add_action( 'genesis_after_header', 'genesis_entry_header_markup_close', 13 );
genesis();
genesis();
这篇关于如何为创世纪子主题移动页面标题而不是帖子标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!