How to Disable Schema Markup Added by Astra?

How to Disable Schema Markup Added by Astra?

If you weren』t already aware, Astra adds what is called 「Schema」 markup to your posts, pages, and the rest of your website. 

Adding Schema is an SEO friendly practice that helps search engines better understand your content, including the search intent.

How does Schema help? Schema tells the search engine more about what is on your page and what the page itself is about. Because search engines can better understand the search intent, this helps boost your rankings in search. 

Removing Schema Generated by Astra

There are various reasons you may want to remove the Astra generated schema markup. Perhaps you already have a Schema setup on your website that you are happy with, or maybe Schema isn』t something you want to use. Whatever reason, it』s quick and easy to remove.

Table Of Contents

Disable all Astra Generated Schema Disable Schema on a Type by Type BasisWrapping Up

Disable all Astra Generated Schema 

If you don』t want any of the Schema types on your site, add the following code to your child themes functions.php. Not sure what a child theme is? Have a look at our handy child theme guide; and build your own child theme in under 5 minutes using our child theme generator.

add_filter( 'astra_schema_enabled', '__return_false' );

Disable Schema on a Type by Type Basis

If you only want to disable certain schema types, you can do so with the useful code snippets below. 

Note:

Copy the required code from the following list and add it to the child theme』s functions.php file.

Organization Schema

add_filter( 'astra_organization_schema_enabled', '__return_false' );

Person Schema

add_filter( 'astra_person_schema_enabled', '__return_false' );

SiteNavigationElement Schema

add_filter( 'astra_site_navigation_schema_enabled', '__return_false' );

WPHeader Schema

add_filter( 'astra_wpheader_schema_enabled', '__return_false' );

WPFooter Schema

add_filter( 'astra_wpfooter_schema_enabled', '__return_false' );

WPSideBar Schema

add_filter( 'astra_wpsidebar_schema_enabled', '__return_false' );

BreadcrumbList Schema

add_filter( 'astra_breadcrumb_schema_enabled', '__return_false' );

CreativeWork Schema

add_filter( 'astra_creativework_schema_enabled', '__return_false' );

Wrapping Up

Schema type not listed here? Don』t worry! It can still be disabled; however, you』ll need to disable all Astra schema globally with the code snippet further up the article.

Deprecated Google Fonts Filter

Deprecated Google Fonts Filter

From the Astra theme version 2.5.0, we are making some changes on how the Google Fonts file will be served. Previously, this used to cause a rare error with WP_Filesystem() on some servers.

For the same, we are deprecating the filter: astra_google_fonts_json_file

Now, instead of the above filter, users will now be using new filter: astra_google_fonts_php_file

Note: For users who are getting this PHP Notice after the update –

Deprecated: astra_google_fonts_json_file is deprecated since version 2.5.0! Use instead. `astra_google_fonts_php_file`.

If you need to switch their Google Fonts file from JSON to PHP you can simply do it using this new filter –

add_filter('astra_google_fonts_php_file', 'asrta_add_new_google_php_file');

function asrta_add_new_google_php_file() {
return get_stylesheet_directory() . '/google-new-fonts.php';
}

And here』s the link to the demo fonts file and the array how you should add and insert new Google fonts. You can modify the file path in the above filter based on the file name – google-new-fonts.php.

Note: Add the above code into the child theme』s functions.php file.

Change Footer Widget Title』s Heading Tag

Change Footer Widget Title』s Heading Tag

When you add a widget in the footer, a default heading tag that will be applied to widget title is H2

If you wish to change this heading tag use the following custom code. Add the respective filter code in the child theme』s functions.php file. 

// Footer Widget 1
add_filter( 'astra_advanced_footer_widget_1_args', 'widget_title_footer_1_tag', 10, 1 );

function widget_title_footer_1_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 2
add_filter( 'astra_advanced_footer_widget_2_args', 'widget_title_footer_2_tag', 10, 1 );

function widget_title_footer_2_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 3
add_filter( 'astra_advanced_footer_widget_3_args', 'widget_title_footer_3_tag', 10, 1 );

function widget_title_footer_3_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 4
add_filter( 'astra_advanced_footer_widget_4_args', 'widget_title_footer_4_tag', 10, 1 );

function widget_title_footer_4_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

// Footer Widget 5
add_filter( 'astra_advanced_footer_widget_5_args', 'widget_title_footer_5_tag', 10, 1 );

function widget_title_footer_5_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

You can choose from the required filter for the respective widget and update the tag as per your requirement.

For e.g. You are looking to update the Third Footer widget title for that you will need to copy the code just as below and paste it in your child theme』s functions.php.

add_filter( 'astra_advanced_footer_widget_3_args', 'widget_title_footer_3_tag', 10, 1 );

function widget_title_footer_3_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

Note:

If you have built the Footer using the Footer builder of Header Footer builder, please use the below code –

add_filter( 'astra_footer_widget_1args', 'widget_title_footer_1_tag', 10, 1 );

function widget_title_footer_1_tag( $atts ) {
$atts['before_title'] = '

';
$atts['after_title'] = '

';
return $atts;
}

Note:

Please note, that you pick the correct filter having the number and update the heading tags h4 or other as required.Refer this doc on How to Add Custom PHP Code?

Filters to Support CPTs for Blog Meta and Single Blog Meta

Filters to Support CPTs for Blog Meta and Single Blog Meta

You can add the following filters to insert Blog Meta and Single Blog Meta to the Custom Post Types ( CPTs ) in the child theme』s functions.php –-

/*
* Filters to support meta-structure for CPT Single Posts & Archive
*/

add_filter( 'astra_blog_archive_post_type_meta', 'astra_blog_archive_post_type_meta_func' );

function astra_blog_archive_post_type_meta_func( $post_type_array ) {
array_push( $post_type_array, 'movies' ); //Here movies is the slug of CPT, you will need to update with the respective slug of your CPT
return $post_type_array;
}

add_filter( 'astra_single_post_type_meta', 'astra_single_post_type_meta_func' );

function astra_single_post_type_meta_func( $post_type_array ) {
array_push( $post_type_array, 'movies' ); //Here movies is the slug of CPT, you will need to update with the respective slug of your CPT
return $post_type_array;
}

Note

Refer this doc on How to Add Custom PHP Code?

Blog Featured Image Size Not Working / Error in Image Processing Library

Blog Featured Image Size Not Working / Error in Image Processing Library

Are you facing any of the following issues listed below? We tried finding the probable cause but this being a rare scenario we have provided a filter to disable the cause and resolve such issues.

Types of Issues / Errors for which this document is valid –

Class is not found – WP_Image_Editor_ImagickCall to undefined method WP_Image_Editor_Imagick::get_error_message()wp_options table is bloated with entries like this – wp_addon_database_migration_batch_4935ee10bd16fca38a7cb9a9f5904d

In the above cases, there might sometimes be a conflict with the specific servers. For such cases you can disable Image Processing from Astra using the below filter.

You can use the following filter in the child theme』s functions.php –

add_filter( 'astra_image_resizer', '__return_false' );

Note

Refer this doc on How to Add Custom PHP Code?

How To Apply New Default Button Padding Values?

How To Apply New Default Button Padding Values?

Astra Theme version 3.6.3 brought changes to default padding values for buttons to improve the default UI. Furthermore, this update came with the fix for Global padding settings not being applied to Gutenberg buttons. 

Why Do I Need This Improvement?

Previously, the theme default button padding values were 10px on top and bottom and 40px on the left and right sides. These settings negatively influenced the visual appeal of the buttons as they made buttons too wide.

That』s why we updated these values to 15-30px (top, bottom – right, left).

Also, if you used Gutenberg for your posts or pages, you might have noticed that the button padding values you set at Customizer > Global > Buttons didn』t apply and that you needed to set these values manually for each button.

Though these things were changed with Astra 3.6.3 update, this won』t be applied automatically to your website to avoid any adverse effects on your existing websites.

How To Fix This?

For all new websites, these changes will be applied automatically. 

As mentioned, for the existing website, this improvement needs to be activated by adding a filter. This was done to allow you to check how these changes apply to your website and make any changes if needed. 

To apply the improvement to your existing website, you would need to add a filter to the functions.php file of your Child Theme. If you don』t have your Child Theme installed, please check this article on how to do it. Please add the following filter:

add_filter( 'astra_update_button_padding_defaults', '__return_true' );

If you are not sure how to add this code, please check this article.

How to Fix Font-Weight Not Applying To Widget Titles?

How to Fix Font-Weight Not Applying To Widget Titles?

Previously, font-weight for widgets (all sidebar, footer, header) titles was applied only as 「normal」 no matter the weight set for the headings, even though this is a heading pattern.

With Astra Theme update 3.6.0, this issue was fixed, and now the heading settings are being appropriately applied to widget titles too.

If this improvement is not applied automatically to your website, this document will help you fix this.

Why Do I Need This Improvement?

So far, if you wanted to set your widget titles weight, you needed to add some custom CSS for this. 

Now this can be done from Customizer (Global Settings > Typography > Headings) by setting the weight for the appropriate heading type with these improvements. 

How To Fix This?

For all new websites, these changes will be applied automatically. 

For the old users, this improvement needs to be activated by adding a filter. This was done to avoid any potential issues with existing websites, which could have appeared in some cases if these improvements would have been applied automatically. 

To apply the improvement to your existing website, you would need to add a filter to the functions.php file of your Child Theme. If you don』t have your Child Theme installed, please check this article on how to do it. Please add the following filter:

add_filter( 'astra_heading_fonts_typo_support', '__return_true' );

If you are not sure how to add this code, please check this article.

Fix Spacing Issues in Gutenberg Blocks

Fix Spacing Issues in Gutenberg Blocks

Starter Templates plugin offers an option to import Gutenberg Templates and Blocks Patters. You can directly import templates inside the block editor.

Sometimes, after importing a template, you might observe some spacing or alignment changes compared to the original template you previewed before importing.

If you are experiencing some spacing differences after importing Gutenberg templates or block patterns, you can fix it quickly.

All you have to do is use a simple custom code.

Paste the following code in your child theme』s functions.php file.

add_filter( 'astra_gutenberg_patterns_compatibility', '__return_true' );

Note: If you are an existing Astra user and updating it from previous versions to v3.3, then only you will need this. If you start using Astra from version 3.3 and above you will not need to add this code.

Filter to Add Support for Gutenberg Cover and Group blocks

Filter to Add Support for Gutenberg Cover and Group blocks

Are you looking to add support for the Cover and Group blocks? Now with the Astra Theme version 2.5.0, it will be resolved –

For New Users:

On your fresh or new installations, compatibility for Cover and Group blocks will be provided by default.

For Existing Users:

You can use the following filter in the child theme』s functions.php to provide Support for the Cover and Group blocks –

add_filter( 'astra_gtn_group_cover_css_comp', '__return_true' );

Compatibility to Remove Margin-top and Bottom

We have provided another compatibility to remove the margin-top and bottom in case of Full Width – Contained / No sidebar & when No header is selected.

If the users want the top and bottom margin, you can use the following filter in the child theme』s functions.php –

add_filter( 'astra_content_margin_full_width_contained', '__return_false' );

Note

Refer this doc on How to Add Custom PHP Code?