Astra Tutorial: How to hide the display of articles, pages or other types of titles

in using WordPress + Astra When the theme creates a website, you don't want to show the default title (such as the post name or page name at the top of the page) in the front page.Astra provides two ways to hide the title:Setting through the interface respond in singing Batch processing using codeThe

图片[1]-WordPress Astra 主题隐藏页面标题的两种方法

This article will describe the use of each of these two methods.

图片[2]-WordPress Astra 主题隐藏页面标题的两种方法

Method 1: Use visual buttons to hide the title

Astra The theme has a built-in feature to visually hide headers, you can directly edit theweb pageTurn off the header display in without having to go into complicated theme settings or write code.

Operational Steps:

  • log in WordPress the area behind a theatrical stage
  • go into Pages > All PagesSelect the page where you want to hide the title, e.g. "About Us".
图片[3]-WordPress Astra 主题隐藏页面标题的两种方法
  • Mouse over the title area and an "eye icon" will appear.
图片[4]-WordPress Astra 主题隐藏页面标题的两种方法
  • Click on this icon to hide the title
  • Click the "Update" button to save the settings and preview the frontend effect.

Effect Description:

  • Before enabling: the top of the page will show the defaultcaptionsuch as "About Us"
图片[5]-WordPress Astra 主题隐藏页面标题的两种方法
  • When enabled: the title will not appear on the front of the page and the page structure will be cleaner
图片[6]-WordPress Astra 主题隐藏页面标题的两种方法

If you need to do this for multiple pages, it is recommended to use the Astra Bulk Edit Plug-inIt allows you to batch edit the title display status of multiple pages at the same time to improve efficiency.

Need to redisplay the title? Simply click on the "eye icon" again to restore it.

Method 2: Hide titles site-wide through code (for developers)

If you wish to turn off all post or page titles uniformly, rather than setting them manually one by one, you can add the following code to the child theme's functions.php Documentation:

/**
 * Hide title in specified article type
 */
function your_prefix_post_title() {
    $post_types = array('page','post'); // Customizable post types for which titles need to be hidden

    if ( ! in_array( get_post_type(), $post_types ) ) {
        return; }
    }

    add_filter( 'astra_the_title_enabled', '__return_false' ); }
}
add_action( 'wp', 'your_prefix_post_title' ); }

Customized Description:

You can do this by modifying the $post_types = array(...) to determine which article types' titles need to be hidden. Example:

  • Hide only all article titles:array('post')
  • Hide all page titles only:array('page')
  • Hide pages, articles & custom types at the same time:array('page','post','custom-type-1')

Caveats:

  • It is recommended that thesubthemeto avoid loss of customization code after the theme is updated.
  • If you are not using a child theme, please refer to the above child theme link documentation to create one.
  • It is recommended to back up your website before adding code to ensure security

summarize

Astra Provides a flexible way for you to control whether the page title is displayed or not, whether it is set on a separate page or the whole site uniformly hidden, can be achieved through simple operation or code. For pages that only need to hide titles occasionally, use the "eye icon" approach is more intuitive; while users who wish to batch process are recommended to use the code approach with child theme management.


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:托尼屎大颗
THE END
If you like it, support it.
kudos422 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments