如何为创世纪子主题移动页面标题而不是帖子标题 [英] How to move a Page title but not a Post title for a Genesis child theme

查看:116
本文介绍了如何为创世纪子主题移动页面标题而不是帖子标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我问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个选择:

  1. 您可以将function.php中的代码与条件标签(例如is_singular('page')
  1. You can use the code in functions.php with a conditional tag like is_singular('page') See this tutorial
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆