A comprehensive guide to Astra theme breadcrumb navigation

crumbNavigation is an important feature of a website that helps users keep track of where they are in the site and understand the site structure. In many WordPress In themes, including Astra, the root element of the breadcrumb navigation is usually displayed as "HOME". If you wish to change this to another tag that better fits the needs of your website, here's how to do it Astra Detailed steps for the "HOME" string in the theme.

Image [1] - Detailed explanation of breadcrumbs in Astra theme

Changing the "HOME" string in breadcrumbs

If you are using the Astra theme and have administrator privileges, you can follow the steps below to make changes:

Image [2] - Detailed explanation of breadcrumbs in Astra Theme

Step 1: Login to WordPress management back office

First, log in to the WordPress admin backend using your administrator credentials.

Step 2: Go to Theme File Editor

Navigate in the backend to exterior condition > Theme File EditorThe

Step 3: Editing functions.php file

In the Theme File Editor, locate the list of files on the right and select the functions.php Documentation.

Step 4: Add Code

exist functions.php file, add the following code snippet:

add_filter( 'astra_breadcrumb_trail_labels', function( $args ) {
    $args['home'] = __( 'Index', 'astra' ); // replace 'Index' with the desired text
    return $args.
}).

This code will change the "HOME" label in the breadcrumbs to "Index". You can replace "Index" with any desired name, such as "New Flat" or other suitable text.

Image [3] - Detailed explanation of breadcrumbs in Astra theme

Step 5: Save the file

When you're done, click Updated documents button to save the changes.

typical example

Let's say there is a page named "Construction" and you want to change the "HOME" string in the breadcrumbs to "New Flat". The code should be modified like this:

add_filter( 'astra_breadcrumb_trail_labels', function( $args ) {
    $args['home'] = __( 'New Flat', 'astra' ); // change to 'New Flat'
    return $args.
}).

After saving these changes, the "HOME" in the breadcrumb will be displayed as "New Flat".

Image [4] - Detailed explanation of breadcrumbs in Astra Theme

Other matters

  • Use a child theme, custom layout, or code snippet plugin: It is recommended to add custom code via a child theme or code snippet plugin. This ensures that changes are not lost when the theme is updated.
  • Backup: in the context of a revision functions.php Before you file, be sure to back up your website and theme files so that you can restore them in the event of a problem.
  • Restore changes: If you have problems with the changes, you can delete the functions.php The code snippet in the file is restored to its original state.

Show breadcrumb navigation on pages or posts

Astra It also allows breadcrumb navigation to be displayed anywhere on a page or article using a shortcode. By default, breadcrumb navigation is displayed within the header, below the header and above the title. If you wish to display the breadcrumb navigation in other locations on the page, you can use the following shortcode:

[astra_breadcrumb]

Request:

  • Use breadcrumb shortcode, must be installed and activated Astra Pro plug-in (software component)The
Image [5] - Detailed explanation of breadcrumbs in Astra Theme

Shortcodes can be inserted into custom layouts, sidebar widgets, page builders, or wherever you wish to display breadcrumbs.

Image [6] - Detailed explanation of breadcrumbs in Astra Theme

Switching from old breadcrumb navigation to new navigation paths

If one wants to convert an existingcrumbNavigation switches to the new breadcrumb path of the Astra Pro plugin, which can be used with the following filters:

add_filter( 'astra_addon_advanced_headers_use_astra_breadcrumb_trail', '__return_true' );

How to apply:

  • Add the code to the subtheme functions.php file Center.
  • Enable a new breadcrumb path for the Astra Pro plugin.
Image [7] - Detailed explanation of breadcrumbs in Astra Theme

summarize

utilization Astra Themes that can be easily changedcrumbHOME" string in the navigation to better fit the structure and needs of the site. It is also possible to use the Astra Pro plugin to display breadcrumb navigation in any position and switch to the new navigation path via filters. If you have problems performing these steps, feel free to submit a support request and we'll be there to help.


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
Customer Service
Customer Service
Tel: 020-2206-9892
QQ咨詢:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
? Reprint statement
This article was written by: thieves will be rats and mice courage
THE END
If you like it, support it.
kudos495 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments