FAQs – Astra Pro 3.2 – Custom Layout Inside Pages/Posts

FAQs – Astra Pro 3.2 – Custom Layout Inside Pages/Posts

With Astra Pro 3.2 we have released a new option in Custom Layouts addon – Inside Post/Page Content.

This feature let users display custom layout inside Gutenberg page/post. Read about this in detail here.

Here we have listed few objections users might have with this update –

1. Can I display custom layout inside pages/posts built with other page builders like Elementor? [Example – I am an Elementor user and I wish to display a custom layout inside my Elementor pages.]

This is not possible at the moment. The custom layout can be displayed only inside pages built with the Gutenberg block editor.

You can design custom layouts with the block editor, Elementor, or Beaver Builder, but you can display it only on Gutenberg pages/posts.

2. Is there any plan to add support for other page builders?

The team does not have any plan for this as of now. You can keep track of our latest updates from the changelog, blog posts, Facebook group.

How to Remove Inline CSS from Astra?

How to Remove Inline CSS from Astra?

The following filter will remove inline CSS generated by the Astra theme and Astra Pro plugin. Paste the following code into child theme』s functions.php file

IMPORTANT NOTE: This filter will remove all the inline CSS added by Astra which will affect the styling of your website.

function astra_force_remove_style() {
add_filter( 'print_styles_array', function($styles) {

// Set styles to remove.
$styles_to_remove = array('astra-theme-css', 'astra-addon-css');
if(is_array($styles) AND count($styles) > 0){
foreach($styles AS $key => $code){
if(in_array($code, $styles_to_remove)){
unset($styles[$key]);
}
}
}
return $styles;
});
}
add_action('wp_enqueue_scripts', 'astra_force_remove_style', 99);

How to Enable Debugging in WordPress (Debug Mode)

How to Enable Debugging in WordPress (Debug Mode)

What is debugging?

When working with your website, different themes, and plugins, you』ll inevitably encounter some problems. These can sometimes consume hours of your time while trying to find out the root of the problem. This is where debugging can help. You can enable debugging in different ways, and this document will show you how to do it.

Installing a new plugin or theme, updating, or adding a custom code can cause conflicts. Some issues will show immediately and can even make your website temporarily unusable (e.g., the White Screen of Death). Others will show only in certain situations and will create issues with some functionality or plugin. These issues can often be solved by manually deactivating all of your plugins and re-activating them one by one. This way you can find which plugin is creating the issue. Further, you can switch to another theme to check if the issue is coming from that side. All of this takes a lot of time.

If you enable the debug mode, it will display a log of PHP errors and warnings. This can help you find the source of the issue you』re facing quickly.

You could even use this to prevent some issues. Some errors, if they exist, will only be visible in debug log even though everything seems fine on your website.

You can enable debug mode by using a plugin or manually. We will show you how to do it using both methods.

No matter which method you choose, It』s advisable to do this in your staging environment (same as your new installations, updates, etc.) as errors will become visible on both your frontend and dashboard. Thus, doing this on your staging environment will enable you to check errors and fix whatever issues you find without disturbing your visitors.

Method 1 – Enable Debugging using a plugin

If you』re not sure about working with your website files or find Method 2 just too complicated, the WP Debugging plugin is the right solution for you. You can enable debugging using the plugin by following these steps:

Step 1 – Navigate to Dashboard > Plugins > Add New;

Step 2 – In the search bar, type wp debugging;

Step 3 – Click the 「Install」 button on the WP Debugging card in the results. Once the plugin is installed, an 「Activate」 button will appear in the same place;

Step 4 – Click the 「Activate」 button;

Step 5 – Navigate to the Dashboard > Tools > WP Debugging;

Step 6 – Click on the check box next to the 「Set WP_DEBUG to true」 option and click on the 「Save Changes」 button.

Don』t forget to disable the debug mode after you』re done.

Method 2 – Enable Debugging using manually

Alternatively, if you prefer to do this manually and have no problem with editing your website files, or you』re locked out of your website (e.g., White Screen of Death) and don』t have another option, we will show you how this could be done by editing your wp-config.php file.

How to access the wp-config.php file?

Before making any changes to any of your files, please create a complete backup of your website. Also, it is advisable to make a copy of the original file before editing it – in case something goes wrong, you can always use this original file to start over.

For this article, we』ll use the FileZilla FTP client, so please install it on your computer (unless you are familiar with another FTP client you would prefer to use). Let』s start:

Step 1 – Add your FTP access data to FileZillas』 Site Manager

Step 2 – Connect to your server

Step 3 – Navigate to your websites』 public_html (root) folder. Here you should find the found your wp-config.php file.

Step 4 – Right-click on the file and select 「Download』 to copy the file to your computer.

Step 5 – Open the file using the code editor to edit the file. You can edit the file using some of the code editors like Sublime Text or Notepad++.

Step 6 – Scroll down to the 「That』s all, stop editing! Happy publishing」 line

Step 7 – Add the following value before that line and save changes:

define( 'WP_DEBUG', true);

define( 'WP_DEBUG_LOG', true);

Step 8 – Once you modified your file, just upload the file back to your server (using the FTP client), replacing the original file with this modified one.

By following these steps, you will enable your debug mode and create a debug.log file where your errors will be saved.

To disable the debug mode once you』re done, repeat the steps for enabling, just this time, either completely remove the previously added code or modify it as follows:

define( 'WP_DEBUG', false);

How to use debugging?

If you』re trying to debug some issue you』re currently experiencing, you』ll need to repeat the steps that led to this issue once your debug mode is enabled. This will make a new error log, and you』ll be able to check it out.

Viewing the debug log

Method 1 – Using the plugin: click on the 「Debug Quick Look」 menu in your admin bar on the top of your Dashboard screen. In the dropdown menu, click the 「View File」 option. This will open a new tab showing the errors in the debug log.

Method 2 – Manually: access your site files and navigate to the following path public_html/wp-content/debug.log – open the file to view the errors in the debug log.

How To Hide Astra Settings for Specific User Roles?

How To Hide Astra Settings for Specific User Roles?

Astra Settings that you can find on each page or post of your website contain meta settings that give the user more control and the possibility of even overriding some customizer settings on each page or post. This document will show you how to hide Astra Settings for specific user roles on your website, thus limiting their access to these settings.

Why Would I Have a Need To Hide These Settings?

Meta settings are handy for additional customization of a specific page or post that needs to be different from the rest of your website. But, on the other hand, this can impact the design and even disturb the functioning of your website (for example, Disabling Primary Header on Homepage). 

If your website has a more significant number of users with different user roles, or you』re giving access to outside service providers, these users would probably require access to your content on all or some pages or posts. At the same time, they would typically have access to the meta settings too. Thus, your website might require limiting access to Astra』s Meta Settings for specific user roles while still allowing them access to pages or posts content. This might be a security measure or just the prevention of accidental issues with a website design and functions.

How To Do This?

Achieving this would require adding in a little bit of custom code to your website. Please follow these steps:Step 1 – Check your User Roles and the exact names of the User Roles you would like to limit. WordPress comes with some default user roles:

Super AdministratorAdministratorEditorAuthorContributorSubscriber

Also, some plugins could add additional User Roles to this list. You can check your Users and User Roles at Dashboard > Users.

Step 2 – Add the following filter to the functions.php file of your Child Theme:

add_action( 'do_meta_boxes', 'ast_remove_plugin_metaboxes' );

/**
* Remove Astra settings meta box for users that are not administrators
*/
function ast_remove_plugin_metaboxes(){
if ( ! current_user_can( 'administrator' ) ) {
remove_meta_box( 'astra_settings_meta_box', 'page', 'side' ); // Remove Astra Settings in Pages
remove_meta_box( 'astra_settings_meta_box', 'post', 'side' ); // Remove Astra Settings in Posts
}
}

The code mentioned above will be applied to the user roles lower than the Administrator user role – to apply this to different user roles, you can change the bolded role name 「administrator」 to any user role you wish. This will limit access to Astra』s Meta Settings for all lower roles that the one set in the code. For example, if we would want to set this limit to lower roles than Editor, this line of the code would look like this:

if ( ! current_user_can( 'editor' ) ) {

This change will now allow access to Astra』s Meta Settings to Administrators and Editors but limit it for all other (lower) roles.

Also, the code above will hide Astra Settings on both pages and posts. If you wish to, for example, leave access to these settings in Posts but hide it on Pages for a specific user role, you can do this by removing the line of code related to Posts:

remove_meta_box( 'astra_settings_meta_box', 'post', 'side' ); // Remove Astra Settings in Posts

If you don』t have your Child Theme installed, please check this article on how to do it.If you are not sure how to add this code, please check this article.

Disable Astra』s Native AMP Functionality

Disable Astra』s Native AMP Functionality

If you want to disable Astra』s integration for AMP, use custom code snippet mentioned below.

Add mentioned filter into child theme』s functions.php file.

// Disable Astra Theme's Native AMP support.
add_filter( 'astra_amp_support', '__return_false' );

Read more about Astra』s AMP integration and other related docs –

Native AMP Support in AstraConfigure AMP Plugin

Why Doesn』t Parallax Scrolling Work on Mobile?

Why Doesn』t Parallax Scrolling Work on Mobile?

Parallax scrolling is a great effect that can give your website a unique look and feel. Parallax scrolling allows your background to move slower than the foreground. This creates the illusion of depth and movement on the website for the visitors. 

If you check it on mobile devices, you』ll notice that your parallax sections don』t work but show static images instead. This document will help you understand why this is happening and how you can work around it.

Why Is This Happening?

The parallax scrolling effect is created by setting your background image position as 「fixed」 (background-attachment: fixed). This fixed image effect (parallax) is currently properly supported only by the Mozilla Firefox browser. 

When you use other browsers on any touch device, parallax scrolling will be overwritten for compatibility reasons. As a result, you will only see a static image instead of your parallax.

Due to responsiveness issues with parallax scrolling on mobile browsers and performance concerns, most mobile browsers still don』t support it. 

What Can Be Done?

Since version 3.0.0 Astra Theme comes with the Header Footer Builder. Thus, you can add a parallax scrolling effect for both the header and footer as Header Footer Builder supports it. 

Let』s show you how to activate this option, for example, for your Primary Footer:

Step 1 – Log in to your website and navigate to Dashboard > Header Builder > Primary Footer> Design > Background

Step 2 – Here, set your background image, and click on 「More Settings」

Step 3 – Under the 「Attachment」 dropdown, select the 「Fixed」 option. 「Publish」 to save changes.

Now that you have your parallax effect set on your desktop, you can add separate settings for different screen sizes since parallax scrolling doesn』t work on mobile. You can use Astra』s responsive editing options to remove parallax and design your footer (or header) for Tablet and Mobile. For this, continue with the following steps:Step 4 – Switch to Tablet/Mobile editing by clicking on the responsive editing icon on the 「Background」 option.

Step 5 – Edit your Background settings for tablet/mobile and 「Publish」

This way, you will be able to have parallax scrolling on desktop screens while having well-designed header and footer sections on tablet and mobile devices at the same time.

What About The Content?

Most often you will add content to your pages and posts by using page builders. Thus, the Astra theme parallax settings will not be applied here.

Therefore, you can use the Page builder responsive editing options in a similar way to Astra』s Header Footer Builder.

Still, in some page builders (Elementor), you will not be able to separately adjust these settings for different viewports. Here, your parallax scrolling will automatically be replaced by a static image.

How to Fix 5XX Error While Importing a Starter Template?

How to Fix 5XX Error While Importing a Starter Template?

Did you try to import templates for your website using the Starter Templates plugin, and your import failed?

Do you see a 5XX error like for example:

Error: 500 Allowed memory size of XXXXXXXX bytes exhausted (tried to allocate XXXXX bytes)

This error can be seen on the Starter Template 「import process interrupted」 notification popup or in the debug.log file.

This can happen if any of the following is true:

There is an issue with plugins on the site (Plugin conflicts / PHP error)There is an issue with the hosting (Resources such as old PHP version / exhausted resources)

Let』s take a look at how this can be fixed:

Step One: Avoid Conflicts

Deactivate all plugins except Starter Templates to get rid of any possible issues with other plugins. And try importing the template again.

Did it work? Awesome!

If not, let』s continue to the next step:

Step Two: Check WP Debug Log

Enable WordPress debugging mode by installing the WP Debugging plugin and try importing a starter template. This plugin will provide log files to get an idea of what might be causing the issue.

Still no luck? Let』s move on.

Step Three: Update PHP Version

WordPress works with PHP versions as old as PHP 5.6. However, all PHP versions before PHP 7.3 are end-of-life (EOL), meaning they no longer receive updates. Because of this, your site may be exposed to security vulnerabilities.

Moreover, old PHP versions slow down the website and cause other issues.

This article will help you understand how to check the PHP version of your website. We recommend getting on the latest possible PHP version, or at least 7.3.

Step Four: Increase Resources Set by Host

In many cases, Starter Templates import can fail because of the limits set by server PHP configuration.

Your website needs a certain amount of resources to function properly. Depending on the activities on your website and all the plugins running, there may be just not enough resources left for the successful template import. In this case, we would suggest modifying your PHP configuration to the following recommended values (values are approximate):

memory_limit = 512M
max_execution_time = 900
max_input_time = 900
post_max_size = 256M
upload_max_filesize = 720M

These settings will ensure that there are enough resources on your website, even if you』re, for example, running some highly demanding plugins. These are not, in any case, the minimum required values, as the Starter Templates plugin needs minimal resources. Thus, you can also try increasing your values gradually and checking if you can import your template successfully with those settings.

For many non-techie users, this might feel daunting, and checking the log files process will differ from host to host. So it is always better to get it done by someone who knows it well.

So feel free to get in touch with your hosting company, and they will be happy to do it for you.

Here is an email that you can send:

Host Email Template:

Hello,I』m trying to import a starter template from the plugin: https://wordpress.org/plugins/astra-sites/. And it appears that my website is getting a 500 – Internal Server Error. Is it possible for you to:1) Enable WordPress debugging mode2) Check the log files3) Share the file with me?Also the plugin documentation mentioned recommended PHP configuration to be used. Could you please apply the following values for my website:PHP Version: 7.3 or latest possiblememory_limit = 512Mmax_execution_time = 900max_input_time = 900post_max_size = 256Mupload_max_filesize = 720MCan you help me with this?

Still no luck? Please feel free to get in touch with our support, and we will be happy to take a look. But before that.. one question for you:

Is Your Website With Good Host?

We have mostly seen this happen on low-end hosting. Such hosting servers are shared by many different websites, and hence individual users don』t get enough resources that their website needs to perform properly.

The above PHP configuration helps in many cases, but it does not guarantee your website will get those resources. If a server does not have any resources left, your website won』t have them available for the Starter Template import, no matter how we configure it.

We always recommend opting for decent hosting as it is a crucial part of running a healthy website. If you are looking for recommendations, we have a few. They all come with a trial period / money-back guarantee.

Change Woocommerce Out of Stock Text

Change Woocommerce Out of Stock Text

Astra adds a text 「Out Of Stock」 for the WooCommerece products that have 『Stock status』 as out of stock. Below is the screenshot of how the text displays in the front end on the product –

You can change the 「Out Of Stock」 text with any custom text you want, on both the Product Catalog (Shop page) and Single Product pages using filters.

You need to add the following filters to the functions.php file of your Child Theme:

Add the folowing code to change the 「Out Of Stock」 text on the Product Catalog (Shop page):

add_filter( 'astra_woo_shop_out_of_stock_string', 'out_of_stock_callback' );
function out_of_stock_callback( $title ) {
return 'SOLD';
}

Add the folowing code to change the 「Out Of Stock」 text on the Single Product pages:

add_filter( 'woocommerce_get_availability', 'change_out_of_stock_text_woocommerce', 1, 2 );
function change_out_of_stock_text_woocommerce( $availability, $product_to_check ) {
// Change Out of Stock Text
if ( ! $product_to_check->is_in_stock() ) {
$availability['availability'] = __('SOLD', 'woocommerce');
}
return $availability;
}

Both of these codes will replace the 「Out Of Stock」 text with 「SOLD」. You can modify this by replacing the bolded word 「SOLD」 in both codes with your custom text.

If you don』t have your Child Theme installed, please check this article on how to do it. If you are not sure how to add this code, please check this article.

How To Override Astra』s theme.json in Child Theme?

How To Override Astra』s theme.json in Child Theme?

With WordPress 5.8 update came to the theme.json file. What does that mean? You can use this file to customize editor settings and style your Gutenberg Blocks, all from one place. The Astra theme is one of the first default themes to implement theme.json for Gutenberg Color Palette.

Also, theme.json enables template editor, but since this feature is still in development, we have disabled it until WordPress 5.9 is out. 

This document will show you how to override Astra』s theme.json file to modify your settings and styles. 

How Can I Do This?

To start with, please make sure that you downloaded and installed the Astra Child theme on your website. If you don』t have your Child Theme installed, please check this article on how to do it.

First, you will need to copy the theme.json file in the Astra theme folder and paste it inside the Astra Child theme』s main folder before you start editing the file itself. To do this, you would need an FTP client (like FileZilla, for example) installed on your computer and your website』s FTP access details.

We』ll use the FileZilla FTP client for this article, so please install it on your computer (unless you are familiar with another FTP client you would prefer to use).

Let』s start:

Step 1 – Add your FTP access data to FileZillas』 Site Manager and connect to your server;

Step 2 – You need to locate the theme.json file. Navigate to Astra theme folder (public_html > wp-content > themes > astra) Here you should find the file. Copy the file;

Step 3 – Next, navigate to the Astra Child theme』s main folder (public_html > wp-content > themes > astra-child; keep in mind that the folder name can be different if you』ve changed the name of the child theme when generating the child theme on our website). Paste the theme.json file here.

Now, you can access and modify Astra』s theme.json file copy in the Child theme, which will override the theme』s original file.

How Can I Edit Astra』s theme.json File?

Step 1 – Log in to your website Dashboard and navigate to the Appearance > Theme Editor. Choose the Astra Child in the theme selector (upper right corner);

Step 2 – Click on the theme.json file in the 「Theme files」 list;

Step 3 – Update the values and make any other changes you need to the theme.json file. Click the 「Update file」 button to apply the changes. 

Below, you can find several examples of changes made to the original theme.json code. As mentioned, you should make these changes in the code of the copy of our theme.json file, which you previously added to the Astra Child Theme.

Modify the palette colors

Your theme.json file contains the following code for defining the nine palette colors available within your Gutenberg Blocks color settings:

{
"version": 1,
"settings": {
"color": {
"palette": [
{
"name": "Theme Color 1",
"slug": "ast-global-color-0",
"color": "var(--ast-global-color-0)"
},
{
"name": "Theme Color 2",
"slug": "ast-global-color-1",
"color": "var(--ast-global-color-1)"
},
{
"name": "Theme Color 3",
"slug": "ast-global-color-2",
"color": "var(--ast-global-color-2)"
},
{
"name": "Theme Color 4",
"slug": "ast-global-color-3",
"color": "var(--ast-global-color-3)"
},
{
"name": "Theme Color 5",
"slug": "ast-global-color-4",
"color": "var(--ast-global-color-4)"
},
{
"name": "Theme Color 6",
"slug": "ast-global-color-5",
"color": "var(--ast-global-color-5)"
},
{
"name": "Theme Color 7",
"slug": "ast-global-color-6",
"color": "var(--ast-global-color-6)"
},
{
"name": "Theme Color 8",
"slug": "ast-global-color-7",
"color": "var(--ast-global-color-7)"
},
{
"name": "Theme Color 9",
"slug": "ast-global-color-8",
"color": "var(--ast-global-color-8)"
}
]
}
}
}

To change any of the colors in your Guttenberg editor, just replace the values for Name, Slug, and Color like shown in this example:

{
"name": "Lipstick",
"slug": "lipstick",
"color": "#9f1f19"
},

If you wish to have fewer colors in the Gutenberg palette, you can remove code for the colors you don』t need. Likewise, if you need more colors than these nine default ones, you can just add them using this code template:

{
"name": "COLOR NAME",
"slug": "SLUG",
"color": "HEX Color Code"
},

All color codes should be added between the brackets.

Remove the 「Custom Color」 option

Your Gutenberg editor users will still be able to get their custom colors next to the colors you added to your palette using the 「Custom Color」 option. If you want to hide this option and limit users to the palette colors, you can modify the theme.json file by adding the following code:

"custom": false

This code should be added at the end of the theme.json code, between brackets and curved brackets. Don』t forget to add 「,」 (comma) after the bracket, like this:

..."name": "Theme Color 9",
"slug": "ast-global-color-8",
"color": "var(--ast-global-color-8)"
}
],
"custom": false
}
}
}

Update the color palette for the Paragraph Block

You can also add color limitations only for specific Blocks to Astra』s theme.json file. This is an example of how you can limit the Paragraph Block only to show the first three colors in the editor:

"blocks": {
"core/paragraph": {
"color": {
"custom": true,
"palette": [
{
"name": "Lipstick",
"slug": "lipstick",
"color": "#9f1f19"
},
{
"name": "Theme Color 2",
"slug": "ast-global-color-1",
"color": "var(--ast-global-color-1)"
},
{
"name": "Theme Color 3",
"slug": "ast-global-color-2",
"color": "var(--ast-global-color-2)"
}
]
}
}
}

This code should be added the same as the previous one – at the end of the theme.json code, between brackets and curved brackets, with 「,」 (comma) after the bracket.

Note:

The theme.json file allows you to make quite a number of additional modifications: Please check this link for more details.

How to Fix Operation Timed Error While Importing a Starter Template?

How to Fix Operation Timed Error While Importing a Starter Template?

When you import a template, the data are being transferred to your server. If you see the error description like the one shown below, the error is caused by a server not being able to respond to a connection request in a timely manner:

Error: 500 Maximum execution time of XXX seconds exceeded

The connection request flow looks like this:

That means that the whole flow you see in the image above needs to be completed within the set time frame (30 seconds in this case). If the above connection request flow does not complete in the allowed time frame, it will cause the connection request to timeout and the import process to fail.

How To Fix This?

Please follow these steps and try importing again with each step. Let』s start:

Simply try importing the template again. Something temporary could have caused the delay. Chances are, it works in the next attempt.No luck with the previous step? Try again but using a different browser. There might be something in your browser (maybe an extension) blocking the request and causing a time-out.Next, if you』re using VPN, please try turning it off.If that didn』t help, please temporarily deactivate a security plugin on your website if you』re using it (Ex – Wordfence, iThemes Security, etc.)If all previous steps didn』t solve it, deactivate all of your plugins except Starter Templates and give it another try (some other plugin on your website may be causing conflict)

Still Having Issues?

Contact your hosting provider and ask them to help, as your host might be causing the conflict. You could use the following template to contact your hosting provider:

Host Email Template:

Hello,I』m building a WordPress website using the Astra theme. I』m trying to import a template using the 「Starter Templates」 plugin (https://wordpress.org/plugins/astra-sites/), but the process keeps failing. Here is the error notice I am receiving – 『WP_Error – cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes receivedWould you please take a look? I』m looking forward to hearing from you.Thank you!Regards,Your name

Still Not Fixed – Let Us Know? 

Open a support ticket with us here, and we will be happy to take a look. If you』re our Premium user, you can expect a reply from our Support team in a maximum of 24 hours. If you』re a free user, don』t worry our Support team will help you out, but it might take a few days as we prioritize tickets.

We will need the FTP details of your server, so please include these in your support request.