Docs – Astra https://wpastra.com Fast, Lightweight & Customizable WordPress Theme for Any Website Thu, 30 Nov 2023 08:34:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.3.2 https://wpastra.com/wp-content/uploads/2020/01/favicon-astra2x.png Docs – Astra https://wpastra.com 32 32 Change “Leave A Comment” title tag https://wpastra.com/docs/customize-comment-title-tag/ https://wpastra.com/docs/customize-comment-title-tag/#respond Thu, 30 Nov 2023 08:21:51 +0000 https://wpastra.com/?post_type=docs&p=168733 Change “Leave A Comment” title tag Read More »

]]>
Changing the title tag allows you to align the comment section with your website’s overall design and branding. You can adjust the styling, such as adding specific HTML tags or classes, to make it visually consistent with the rest of your site.

If you’re using the Astra theme and want to customize the “Leave A Comment” title tag in your comment section, you can easily achieve this by adding some code to your Astra child theme’s functions.php file.

This quick guide will walk you through the steps to change the “Leave A Comment” title tag using the provided code snippet.

Change "Leave A Comment" title tag

How to Change “Leave A Comment” title tag

Before you begin, make sure you have an active WordPress website and you should have access to your WordPress theme files. Then, you can follow the below steps to change the leave a comment title tag.

Step 1: Create a Child Theme

Before you make any customizations, it’s a best practice to create a child theme to avoid affecting your main theme.

You can use the child theme generator to generate and install the child theme.

Once you download the child theme, go to your WordPress dashboard, navigate to Appearance > Themes, and click on the Add New button. Upload and activate the child theme ZIP file.

You can refer to this document that will help you create a child theme – https://wpastra.com/wordpress-create-child-theme/

Step2: Open the functions.php File

From the WordPress dashboard, navigate to Appearance > Theme File Editor. In the Theme Editor, you should see a list of theme files on the right. Locate and select the functions.php file from the list.

Step 3: Edit functions.php

Open the `functions.php` file in a text editor of your choice. Insert the following code snippet at the end of the file:

add_filter( 'comment_form_defaults', 'leave_a_comment_title_tag' );
function leave_a_comment_title_tag( $defaults ){
  $defaults['title_reply_before'] = '<p id="reply-title" class="comment-reply-title">';
  $defaults['title_reply_after'] = '</p>';
  return $defaults;
}

Step 4: Save Your Changes

After adding the code snippet, click the “Update File” button to save your changes.

Change “Leave A Comment” title tag

Step 5: Check the Result

Visit a page or post on your website with comments enabled, and you should see the “Leave A Comment” title tag customized according to the code you added. It will now be enclosed in a `<p>` tag with the specified class.

Change "Leave A Comment" title tag

That’s it! You’ve successfully customized the “Leave A Comment” title tag in your Astra child theme. This small modification can help you better align your comment section with your website’s design and style.

]]>
https://wpastra.com/docs/customize-comment-title-tag/feed/ 0
Create a Transparent Custom Header https://wpastra.com/docs/transparent-custom-header/ https://wpastra.com/docs/transparent-custom-header/#respond Mon, 27 Nov 2023 08:24:50 +0000 https://wpastra.com/?post_type=docs&p=168573 Create a Transparent Custom Header Read More »

]]>
With Astra Site Builder, you can create a custom header and also make it sticky. However, the transparent header effect is currently available only with the default Astra header.

In such a case, if you need to display a custom header on a few pages with a transparency effect, you will need to make some adjustments in the custom header to enable the transparency effect.

This guide explains how to create a transparent custom header using Astra Site Builder. Before moving further, we recommend checking the instructions on how Custom Header with Astra Site Builder works.

How to Create a Transparent Custom Header

To create a transparent custom header, please follow the below steps to create a custom header first.

Before you start using the Site Builder, make sure you’ve installed and activated the Astra Pro plugin. Also, update both the Astra Theme and Astra Addon to the latest versions to access the Site Builder.

After that, go to the WordPress dashboard, click on Astra, then Astra Pro Modules, and switch on the Site Builder toggle.

Create a Transparent Custom Header

Once you switch on the Site Builder toggle, then you can see the Site Builder under Astra in the wordpress dashboard.

After clicking on the Site Builder, you can explore the revamped Site Builder through the All Layouts Section.

Create a Transparent Custom Header

From the site builder dashboard, you can create a header template.

Create a Transparent Custom Header

You can create a header layout using columns or select the already created design from the patterns.

Create a Transparent Custom Header

Once the header design is added, select the main column or group and clear the background to make it transparent.

For the same block, add the custom class in the additional classes section:

Create a Transparent Custom Header

Apply the display conditions to enable the custom header on the website and publish the changes.

Next, navigate to the Additional CSS section of the customizer and add the following CSS:

.my-transparent-header{

margin-bottom: -100% !important;

}

.my-transparent-header a {

color: #ffffff !important;

}

Note: The class in the above CSS should match with the class added in the custom header block.

Publish the customizer changes, and the transparent custom header should be enabled on the website.

Create a Transparent Custom Header

You can further modify it according to your requirements by adding additional design options using the CSS.

We hope this article has been helpful. If you have any questions, please feel free to comment below.

]]>
https://wpastra.com/docs/transparent-custom-header/feed/ 0 Docs nonadult
How to Show Separate Menus on Different Pages https://wpastra.com/docs/custom-menus/ https://wpastra.com/docs/custom-menus/#respond Fri, 24 Nov 2023 09:23:39 +0000 https://wpastra.com/?post_type=docs&p=168474 How to Show Separate Menus on Different Pages Read More »

]]>
Sometimes, you may need to personalize the pages and have a different navigation menu for those pages. Astra allows you to customize your website navigation by displaying different menus on specific pages.

This guide will walk you through the process of setting up separate menu items for different pages, including posts, and other post types.

How to Show Separate Menus on Different Pages

You can show separate menus on different pages using the Page Headers module of Astra Pro

This is the quickest way to display a separate menu in the header without using any external plugin. You can control the visibility of the menu item by changing the display conditions for the page header.

You can follow the below steps to show different menus using the Page Headers module:

  • First, make sure you have installed and activated the Astra Pro plugin.
  • Then, enable the Page Headers module of Astra Pro.
How to Show Separate Menus on Different Pages
  • Navigate to Page Headers and create a new Page Header design.
How to Show Separate Menus on Different Pages
  • In the Page Header, switch to the Site Header and select the Primary Menu you wish to change.
How to Show Separate Menus on Different Pages
  • In the Display Rules, select the pages where you want this page header with a different menu to appear.
How to Show Separate Menus on Different Pages
  • Lastly, click on the Publish button to save the changes.

This way, your page header will have a different menu only on the pages specified in the display conditions.

Note:

This option works only for the Primary Menu in the header. If there are other menu items on the header, this option will not work.

Another option to change the menu on pages involves creating a custom header. This way, you can display a completely different header along with the navigation menu on the pages.

You can use the Site Builder module of Astra Pro to make the custom header. Please follow the instructions here: [Link to the Custom Header doc].

How to Show Separate Menus Using Conditional Menus Plugin

Another option to display a separate menu is by using the Conditional Menus plugin. The plugin is available for free on the WordPress repository.

You can follow the below steps to show different menus on different pages.

  • At first, install and activate the Conditional Menus plugin.
How to Show Separate Menus on Different Pages
  • Navigate to Appearance > Menus and select the menu that you wish to add display conditions.
How to Show Separate Menus on Different Pages
  • Click on the Manage Locations tab
  • Here, you can assign the display conditions and select the menu to be displayed on the pages.
How to Show Separate Menus on Different Pages
  • Click on the Conditions and then select the pages to which you want to apply the menu.
How to Show Separate Menus on Different Pages
  • Save changes, and the menu will change according to the provided conditions.

The above option can be helpful when there are multiple menus on the website. You can create as many menus and display them according to your requirements.

We hope this article has been helpful. Please feel free to leave a comment if you have any questions.

]]>
https://wpastra.com/docs/custom-menus/feed/ 0
Whitelisting Astra Licensing Server From Your Hosting Firewall https://wpastra.com/docs/whitelist-astra-license/ https://wpastra.com/docs/whitelist-astra-license/#respond Tue, 21 Nov 2023 03:41:12 +0000 https://wpastra.com/?post_type=docs&p=168180 Whitelisting Astra Licensing Server From Your Hosting Firewall Read More »

]]>
While activating Astra Pro is typically straightforward, on highly secure servers, our licensing server may face blocking, resulting in random deactivations or activation challenges. In such cases, it becomes necessary to whitelist the Astra Pro licensing server to ensure a smooth activation process.

This document will walk you through the simple steps of whitelisting our licensing server on your hosting, guaranteeing a trouble-free experience when activating your Astra Pro license.

How to Whitelist Astra Licensing Server From Your Hosting Firewall

The Astra licensing server is hosted at `support.brainstormforce.com`, and all licensing requests use HTTPS on port `443`.

To access the hosting firewall, log in to your hosting provider’s dashboard or control panel.

Once there, navigate to the firewall or security settings in your hosting control panel.

Next, add a new rule allowing traffic to `support.brainstormforce.com` on port `443`. Keep in mind that due to CloudFlare proxies, there won’t be a static IP for our licensing server. Therefore, simply whitelist the domain `support.brainstormforce.com` without specifying an IP address.

After adding the rule, verify that your hosting firewall allows outgoing HTTPS requests to the specified domain and port. You can use a tool like `curl` or your browser to make an HTTPS request to `https://support.brainstormforce.com:443`. If the request is successful, your firewall is correctly configured.

By following these straightforward steps, you have successfully whitelisted the Astra licensing server.

We hope this article has been helpful. If you have any questions, please feel free to leave a comment below.

]]>
https://wpastra.com/docs/whitelist-astra-license/feed/ 0
How to Add Additional Content on the My Account Login Page https://wpastra.com/docs/my-account-page-customization/ https://wpastra.com/docs/my-account-page-customization/#respond Mon, 20 Nov 2023 08:28:09 +0000 https://wpastra.com/?post_type=docs&p=168089 How to Add Additional Content on the My Account Login Page Read More »

]]>
Improving the user experience on your WooCommerce store frequently requires customization, especially on the My Account login page.

This document walks you through the steps of adding extra content into the login and registration forms on the My Account page using an Astra child theme in WordPress.

How to Add Additional Content on the My Account Login Page

Before you proceed, make sure you have WordPress installed and configured, and the WooCommerce plugin is activated. Also, ensure that you have set up a child theme to safeguard your modifications during theme updates.

Once the child theme is installed and activated, go to Appearance > Theme File Editor, and find the child theme. Open the functions.php file within the child theme for code customization.

Next, copy and paste the provided code snippets at the end of the functions.php file.

// Add content to the login form
add_action('woocommerce_login_form_start','astra_theme_add_login_text');
  
function astra_theme_add_login_text() {
    echo '<h3 class="bb-login-subtitle">Registered Customers</h3><p class="bb-login-description">If you possess an account with us, please sign in by entering your email address.</p>';
}

// Add content to the registration form
add_action('woocommerce_register_form_start','astra_theme_add_reg_text');
  
function astra_theme_add_reg_text() {
    echo '<h3 class="bb-register-subtitle">New Customers</h3><p class="bb-register-description">Sign up with our store to streamline your shopping experience. Enjoy faster checkout processes, store multiple shipping addresses, and conveniently view and track your orders--all within your account. Unlock additional benefits and make the most of your shopping journey.</p>';
}

Then, save the functions.php file by clicking the Update File button.

The added content should now be displayed on the login and registration forms. You can visit your My Account page to view the changes.

By following these steps, you have successfully customized the My Account login page on your WooCommerce store. Feel free to adjust the HTML content and styling according to your store’s design preferences.

]]>
https://wpastra.com/docs/my-account-page-customization/feed/ 0
Site Builder https://wpastra.com/docs/site-builder/ https://wpastra.com/docs/site-builder/#respond Thu, 16 Nov 2023 11:42:08 +0000 https://wpastra.com/?post_type=docs&p=166721 Site Builder Read More »

]]>
In Astra v4.5.0, we’ve introduced an enhanced All-New Site Builder for your website customization needs. While maintaining the capabilities of the previous Custom Layouts, the Site Builder presents a new user interface to take the Site Building experience to the next level.

What is Site Builder in Astra v4.5.0

The Site Builder provides a visual perspective of the entire site all in one place. Here you can create / view / edit different parts of your site like Header / Footer / 404 Pages / Hooks / Single & Archive templates and much more.

How to Navigate to Site Builder

Before you start using the Site Builder, make sure you’ve installed and activated the Astra Pro plugin. Also, update both the Astra Theme and Astra Addon to the latest versions to access the Site Builder.

After that, go to the WordPress dashboard, click on Astra, then Astra Pro Modules, and switch on the Site Builder toggle.

Site Builder

How to Use Site Builder

Once you switch on the Site Builder toggle, then you can see the Site Builder under Astra in the wordpress dashboard.

After clicking on the Site Builder, you can explore the revamped Site Builder through the All Layouts Section.

Site Builder

Here, you can create / view / edit different parts of your site like Header / Footer / 404 Pages / Hooks / Single & Archive templates and much more.

You can create new sections, and individual layout previews for specific elements like Header, Footer, and 404 sections. These previews provide a visual glimpse of how your layout might appear on the frontend, enhancing your editing experience.

Additionally, you can view all your existing layouts in one place easily. By default if no Layouts are present on your site, it will show the Layouts which you can create. By Hovering on the Layout Card, you will see the option to “Preview” which will take you to that Website Part Section or you can “Edit” which will take you to the Layout Editor.

You can modify their existing Layouts, by visiting the Website Parts from the Sidebar. For example, you can visit the Header Section (this will take you to the Header Website Part) where you can view the Preview of the Existing Layouts on the Site.

Note for Single & Archive Sections:

For Single & Archive Sections – You can set the Display Conditions and the Preview will show a random Post / Page (depending on the Display Conditions). For example – If you create a Single Template with a display condition to show on “All Posts” then the Preview will display a random post depending on the Display conditions set for the Templates.

Troubleshooting Previews:

In case previews are not loading and showing a 404 error, then you can try two methods for resolution.

Method 1:

Clear your cache via WordPress Admin Dashboard > Settings > Permalinks. Click on Save 2-3 times without changing anything. Reload the Site Builder, and the previews should become visible.

Method 2:

Clear your cache via WordPress Admin Dashboard > Astra Dashboard. Click on Activate All, and subsequently deactivate any unnecessary modules based on your preferences. Reload the Site Builder, and the previews should be visible.

Creating New Layouts in Site Builder

Let us consider, if you want to create a different header layout. Now, hover on the Header and click “Create Layout”.

Site Builder

Then you will be taken to the default editor page. If you click on the Astra icon in the top right corner, you will open the Site Builder Setting panel. Further down, you will find the overview of the Header Layout Type options.

Site Builder

Under sticky settings, you can choose your custom header to be sticky or not. If you set the header to stick on the top of the page, you can decide whether it should shrink or not. Enabling shrink effect will remove all top and bottom space from the header. Also, you can choose to stick the header on Desktop and/or mobile.

Site Builder

You can choose your custom header to display on the entire website or specific pages/posts with the Display On option. You can even exclude a particular page/post by adding them to the Exclusion Rule.

You can decide a user role for which custom header should be visible. For excluded users, the header set with customizer options will be visible.

For example: If you want to display a custom header on the Entire Website except for the 404 page for all Logged In users, you need to set the following options –

Display On: Entire Website

Do Not Display On: 404 Page

User Roles: Logged In

Site Builder

Additionally, you can see the Device Visibility option. This option lets you choose a device to display the header layout. Just tick the checkbox for required devices – Desktop, Tablet, and Mobile.

Site Builder

And lastly you can set a start time and end time for layout visibility. Set a date and time duration for the layout.

The layout will be visible for the selected duration.

Site Builder

How to Edit Existing Layouts

To edit the existing layout, from the WordPress dashboard, you can navigate to Site Builder. Here under All Layouts, you can see the existing layouts. Hover over the layouts and click “Edit” to make changes to the existing layouts.

Site Builder

Additionally, in the Site Builder dashboard, you can see the Switch to Table View option.

Site Builder

This option shows the Layouts in a tabular format. This is exactly the same as the Old Custom Layouts View. You can choose to enable or disable specific custom layouts added to your website from here.

Site Builder

For more information on each custom layout type, please check the dedicated documents on the links below:

]]>
https://wpastra.com/docs/site-builder/feed/ 0
How to change “Leave a Comment” string in WordPress https://wpastra.com/docs/change-comment-string/ https://wpastra.com/docs/change-comment-string/#respond Fri, 03 Nov 2023 08:06:42 +0000 https://wpastra.com/?post_type=docs&p=165488 How to change “Leave a Comment” string in WordPress Read More »

]]>
Customizing the default “Leave a Comment” text in WordPress is important for improving how website visitors interact with your site. The original text might not feel welcoming or match your site’s style.

By changing it, you make the comment section more inviting, encouraging visitors to participate in discussions. This small change also shows that you care about the details, making your site look more professional.

How to change “Leave a Comment” string in WordPress

In this step-by-step guide, we’ll walk you through the process of changing the default “Leave a Comment” text to something more tailored, such as “Leave Your Thoughts Here…”.

How to change “Leave a Comment” String

Before you begin, make sure you have the following in place:

  • Ensure that you have an active WordPress website.
  • You should have access to your WordPress theme files.

You can follow the below steps to change the comment title string:

Step 1: Create a Child Theme

Before you make any customizations, it’s a best practice to create a child theme to avoid affecting your main theme.

You can use the child theme generator to generate and install the child theme.

Once you download the child theme, go to your WordPress dashboard, navigate to Appearance > Themes, and click on the Add New button. Upload and activate the child theme ZIP file.

You can refer to this document that will help you create a child theme – https://wpastra.com/wordpress-create-child-theme/.

Step2: Edit the functions.php File

From the WordPress dashboard, navigate to Appearance > Theme File Editor. In the Theme Editor, you should see a list of theme files on the right. Locate and select the functions.php file from the list.

How to change “Leave a Reply” string in WordPress

Step 3: Change “Leave a Comment” String

Insert the following code snippet at the end of the `functions.php` file. This code will change the comment title string.

add_filter('comment_form_defaults', 'wpastra_custom_comment_title', 20);
function wpastra_custom_comment_title( $defaults ){
$defaults['title_reply'] = __('Leave Your Thoughts Here…', 'astra');
return $defaults;
}

Step 4: Update functions.php File

After adding the code snippet, click the “Update File” button to save your changes.

Once you update the file, the comment title should be changed from “Leave a Comment” to “Leave Your Thoughts Here….” easily.

How to change “Leave a Comment” string in WordPress

Hope this document helped you understand how to change the “Leave a Comment” string. If you need help, we’re just a message away.

]]>
https://wpastra.com/docs/change-comment-string/feed/ 0
How to move the “Previous and Next” link to the top of the “Single Blog Post” https://wpastra.com/docs/blog-nav-shift/ https://wpastra.com/docs/blog-nav-shift/#respond Thu, 02 Nov 2023 10:24:02 +0000 https://wpastra.com/?post_type=docs&p=165460 How to move the “Previous and Next” link to the top of the “Single Blog Post” Read More »

]]>
Are you looking to improve the user experience on your WordPress blog by relocating the “Previous” and “Next” navigation links to the top of your single blog post? With a simple snippet of code, you can effortlessly achieve this.

In this document, we’ll guide you through the process of how to move the “Previous and Next” link to the top of the “Single Blog Post” with a simple code snippet.

"Previous and Next" link to the top of the "Single Blog Post"

How to move the “Previous and Next” link to the top of the “Single Blog Post”

Here’s a quick and easy guide to get you started.

  • Log in to your WordPress admin panel using your credentials.
  • In the WordPress dashboard, go to “Appearance” and select “Theme File Editor.”
  • In the Theme Editor, you should see a list of theme files on the right. Locate and select the `functions.php` file from the list.
  • Inside the `functions.php` file, you can add the following code snippet:
add_action('astra_entry_before', 'move_single_post_navigation' );

function move_single_post_navigation() {
    astra_single_post_navigation_markup();
}
  • After adding the code snippet, click the “Update File” button to save your changes.

This code will hook into the astra_entry_before action, which allows you to add content before the single post content.

Alongside this code, it’s necessary to disable the post navigation for individual blog posts. To accomplish this, follow these steps in the customizer:

  • Navigate to Blog > Single Post.
  • Activate the “Disable Post Navigation” toggle.

Together, this code and customization will seamlessly move the “Previous and Next” link to the top of the “Single Blog Post”.

"Previous and Next" link to the top of the "Single Blog Post"

Note: We have documentation or an article for you that will assist you in better understanding it. Here’s the link: https://wpastra.com/docs/add-custom-php-code/.

Now, go to one of your single blog post pages on your WordPress site and refresh the page. You should now see the “Previous” and “Next” navigation links displayed at the top of your blog post content, providing a more convenient reading experience for your website visitors.

"Previous and Next" link to the top of the "Single Blog Post"

That’s it! You’ve successfully moved the “Previous” and “Next” navigation links to the top of your single blog post using a simple code snippet.

Note: Remember to make any changes to your theme’s files with caution, and always keep a backup of your site in case anything goes wrong. If you have any questions or need further assistance, leave a comment below.

]]>
https://wpastra.com/docs/blog-nav-shift/feed/ 0
How to Set the “Review” Tab as the Default Active Tab in WooCommerce https://wpastra.com/docs/default-review-tab/ https://wpastra.com/docs/default-review-tab/#respond Wed, 01 Nov 2023 10:53:51 +0000 https://wpastra.com/?post_type=docs&p=165413 How to Set the “Review” Tab as the Default Active Tab in WooCommerce Read More »

]]>
In an e-commerce store powered by WooCommerce, the product page tabs play a crucial role in providing information to potential customers. By default, the “Description” tab is usually set as the active tab when a user lands on a product page.

However, in some cases, you might want to highlight the “Review” tab as the default active tab to encourage customers to read and leave reviews.

In this tutorial, we’ll show you how to achieve this by adding a simple code snippet to your Astra Child Theme’s functions.php file.

How to Set the “Review” Tab as the Default Active Tab in WooCommerce

Before we get started, make sure you have access to your WordPress admin dashboard. Then, follow these steps:

  • Log in to your WordPress admin panel.
  • Navigate to “Appearance” and click on “Theme Editor.”
  • On the right side, you’ll see a list of theme files. Look for your Astra Child Theme’s functions.php file. It should be located in the theme’s directory.
  • Click on the “functions.php” file to open it for editing.
  • Once you have the functions.php file open, you can add the following code snippet at the end of the file.
add_filter( ‘woocommerce_product_tabs’, ‘woo_reorder_tabs’, 98 );
function woo_reorder_tabs( $tabs ) {
$tabs[‘reviews’][‘priority’] = 5; // Reviews first
$tabs[‘description’][‘priority’] = 10; // Description second
return $tabs;
}
  • After adding the code snippet, make sure to save your changes. Simply click the “Update File” button at the bottom of the editing window.
How to Set the "Review" Tab as the Default Active Tab in WooCommerce

This code will reorder the product tabs’ priority, making the “Reviews” tab the first tab to be displayed and the “Description” tab the second.

Now that you’ve added and saved the code, you can go to any product page on your WooCommerce store to see the “Review” tab set as the default active tab. This change will encourage customers to read and leave reviews, potentially boosting trust and sales on your site.

How to Set the "Review" Tab as the Default Active Tab in WooCommerce

By following the steps outlined in this document and adding the provided code snippet to your Astra Child Theme’s functions.php file, you can easily make this adjustment.

Your online store will benefit from increased visibility of product reviews, which can lead to higher conversion rates and customer satisfaction.

Note:

We have documentation on how to add custom codes. This document will assist you in better understanding it. Here’s the link https://wpastra.com/docs/add-custom-php-code/.
]]>
https://wpastra.com/docs/default-review-tab/feed/ 0
How to Remove Astra Post Excerpt from the Post Archive https://wpastra.com/docs/remove-astra-post-excerpt-from-the-post-archive/ https://wpastra.com/docs/remove-astra-post-excerpt-from-the-post-archive/#respond Tue, 31 Oct 2023 10:31:20 +0000 https://wpastra.com/?post_type=docs&p=165367 How to Remove Astra Post Excerpt from the Post Archive Read More »

]]>
Astra is a popular WordPress theme known for its flexibility and customization options. However, sometimes you might want to make specific changes to its default behavior.

One common customization request is to remove the post excerpt from the post archive pages.

In this document, we’ll guide you through the process of achieving this with a simple code snippet.

Why Remove the Post Excerpt?

Post excerpts are brief summaries of your blog posts that appear on archive pages like category, tag, and author archives. While they can be useful, there are situations where you might prefer not to display the post excerpt.

Perhaps you want to focus solely on the post titles and featured images, or you have a specific design in mind that doesn’t require excerpts.

How to Remove Astra Post Excerpt from the Post Archive

To remove the post excerpt from Astra’s post archive pages, you can follow the below-mentioned steps.

  • Log in to your WordPress admin panel using your credentials.
  • In the WordPress dashboard, go to “Appearance” and select “Theme File Editor.”
  • In the Theme Editor, you should see a list of theme files on the right. Locate and select the `functions.php` file from the list.
  • Inside the `functions.php` file, you can add the following code snippet:
add_filter( 'the_excerpt', 'filter_the_excerpt', 10, 2 );
    function filter_the_excerpt( ) {
    return ' ';
 }
  • After adding the code snippet, click the “Update File” button to save your changes.
How to Remove Astra Post Excerpt from the Post Archive

We have documentation on how to add custom codes. This document will assist you in better understanding it. Here’s the link https://wpastra.com/docs/add-custom-php-code/.

This code uses the add_filter function to hook into the the_excerpt filter. It checks if the current page is an archive page (like category, tag, or author archives)

If it is, the code returns an empty string, effectively removing the post excerpt from those pages.

Once you update the code, then visit one of your post archive pages on your WordPress site, and you’ll notice that the post excerpts are no longer displayed.

Your archive pages will now show only post titles and featured images, or whatever other content you have on your archive pages.

Additionally, there may be instances when you wish to retain the “Read More” button while removing the excerpt. In such cases, you can include the custom code attached below in the functions.php file.

add_filter( 'the_excerpt', 'filter_the_excerpt', 10, 2 );
function filter_the_excerpt( $excerpt ) {
    // Return an empty string to remove the excerpt text
    $excerpt = '';

    // Add the "Read more" button HTML
    $excerpt .= '<a class="ast-button" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'astra' ) . '</a>';

    // Return the modified excerpt
    return $excerpt;
}

Once you update the code, then visit one of your post archive pages on your WordPress site, and you’ll observe that the post excerpts are now hidden, and in their place, you’ll find the “Read More” button prominently displayed.

Note: Remember to make any changes to your theme’s files with caution, and always keep a backup of your site in case anything goes wrong. If you have any questions or need further assistance, leave a comment below.

]]>
https://wpastra.com/docs/remove-astra-post-excerpt-from-the-post-archive/feed/ 0