This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp', 'astra_woo_sidebar_layout' ); | |
function astra_woo_sidebar_layout() { | |
if ( is_shop() || is_product_taxonomy() || is_checkout() || is_cart() || is_account_page() ) { | |
add_filter( 'astra_page_layout', 'astra_page_layout_woo_no_sidebar', 100 ); | |
} | |
} | |
function astra_page_layout_woo_no_sidebar( $sidebar_layout ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'astra_set_direction' ); | |
function astra_set_direction() { | |
global $wp_locale, $wp_styles; | |
$direction = 'rtl'; | |
$wp_locale->text_direction = $direction; | |
if ( ! is_a( $wp_styles, 'WP_Styles' ) ) { | |
$wp_styles = new WP_Styles(); | |
} | |
$wp_styles->text_direction = $direction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add prefix to your Date String. | |
* | |
* @param string $output Markup date. | |
* | |
* @return void | |
*/ | |
function your_prefix_post_date( $output ) { | |
$output = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Astra Gutenberg layout class | |
* | |
* @param string $classes | |
* @return string | |
*/ | |
function astra_gutenberg_layout_class( $classes ) { | |
$screen = get_current_screen(); | |
if( ! $screen->is_block_editor() ) | |
return $classes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'astra_enable_default_fonts', 'temp_disable_astra_fonts' ); | |
function temp_disable_astra_fonts( $load ) { | |
$load = false; | |
return $load; | |
} | |
add_action( 'wp_head', 'add_astra_fonts_preload', 1 ); | |
function add_astra_fonts_preload() { | |
?> | |
<link rel="preload" href="<?php echo get_site_url(); ?>/wp-content/themes/astra/assets/fonts/astra.woff" as="font" crossorigin /> | |
<link rel="preload" href="<?php echo get_site_url(); ?>/wp-content/themes/astra/assets/fonts/astra.ttf" as="font" crossorigin /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Astra WP CLI | |
* Plugin URI: https://www.yourwebsiteurl.com/ | |
* Description: This is the very first plugin I ever created. | |
* Version: 1.0 | |
* Author: Your Name Here | |
* Author URI: http://yourwebsiteurl.com/ | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Command - wp delete-astra-option delete --key={astra-settings key} | |
namespace DeleteAstraOption; | |
use WP_CLI, WP_CLI_Command; | |
if( class_exists( 'WP_CLI_Command' ) ) { | |
class Commands extends WP_CLI_Command { | |
public function delete( $args, $assoc_args ) { | |
$option_key = isset( $assoc_args['key'] ) ? $assoc_args['key'] : false; | |
if( ! $option_key ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp', 'astra_open_submenu_below_header' ); | |
function astra_open_submenu_below_header() { | |
add_filter( 'astra_get_option_submenu-below-header', '__return_true' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$customizer_data = get_option( 'astra-settings', array() ); | |
$is_typo_addon_active = is_callable( 'Astra_Ext_Extension::is_active' ) ? Astra_Ext_Extension::is_active( 'typography' ) : false; | |
for ( $i = 1; $i < 7; $i++ ) { | |
if ( ( ( $i > 3 ) && ( true === $is_typo_addon_active ) ) || ( $i < 4 ) ) { | |
if ( isset( $theme_settings[ 'font-size-h' . $i ] ) && '' !== $theme_settings[ 'font-size-h' . $i ] ) { | |
$elementor_page_settings[ 'astra_sites_heading_' . $i . '_typography' ] = 'custom'; | |
$elementor_page_settings[ 'astra_sites_heading_' . $i . '_font_size' ] = array( | |
'unit' => $theme_settings[ 'font-size-h' . $i ]['desktop-unit'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp', 'astra_search_grid_check', 15 ); | |
function astra_search_grid_check() { | |
if( is_search() ) { | |
add_filter( 'astra_get_option_blog-grid', 'astra_change_grid_search_page', 15, 3 ); | |
} | |
} | |
function astra_change_grid_search_page( $value, $option, $default ) { | |
$value = '2'; |