Skip to content

Instantly share code, notes, and snippets.

Avatar

Balachandar Karuparthy Balachandark

View GitHub Profile
View functions.php
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 />
@Balachandark
Balachandark / functions.php
Last active Dec 17, 2019
Add new markup for navigation
View functions.php
add_action( 'wp', 'remove_astra_woocommerce_action', 11 );
function remove_astra_woocommerce_action(){
if( is_callable( 'ASTRA_Ext_WooCommerce_Markup::get_instance' ) ) {
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'product_navigation_wrapper_start' ), 1, 0 );
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'next_previous_links' ), 1, 0 );
remove_action( 'woocommerce_single_product_summary', array( ASTRA_Ext_WooCommerce_Markup::get_instance(), 'product_navigation_wrapper_end' ), 1, 0 );
}
}
add_action( 'wp', 'add_new_navigation_markup' );
View functions.php
add_filter( 'astra_advanced_header_layout_1_title_tag', 'change_title_tag', 10, 1 );
add_filter( 'astra_advanced_header_layout_2_title_tag', 'change_title_tag', 10, 1 );
function change_title_tag( $tag ) {
$tag = 'h6';
return $tag;
}
View functions.php
add_filter( 'astra_advanced_header_layout_1_title_tag', 'change_title_tag', 10, 1 );
add_filter( 'astra_advanced_header_layout_2_title_tag', 'change_title_tag', 10, 1 );
function change_title_tag( $tag ) {
$tag = 'h6';
return $tag;
}
View functions.php
add_filter( 'astra_advanced_header_layout_1_title_tag', 'change_title_tag', 10, 1 );
add_filter( 'astra_advanced_header_layout_2_title_tag', 'change_title_tag', 10, 1 );
function change_title_tag( $tag ) {
$tag = 'h6';
return $tag;
}
@Balachandark
Balachandark / blog-layout-3.php
Created Dec 6, 2019
Blog Pro - Blog Layout 3 Template
View blog-layout-3.php
<?php
/**
* Blog Pro - Blog Layout 3 Template
*
* @todo Update this template for Default Blog Style
*
* @package Astra Addon
*/
?>
View gist:b33c71baceb4a678a92702f034fc20c8
<?php
$uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); // Removes the leading slash.
$uri = rtrim( $uri, '/' ); // Removes the trailing slash.
$uri = str_replace('/', ' ', $uri); // Replaces the slashes with spaces.
?>
<script type="text/javascript" src="a.remarketstats.com/px/smart/?c=222ccaf40d04fb6&seg=<?php echo $uri; ?>" ></script>
@Balachandark
Balachandark / functions.php
Created Oct 24, 2019
Add Elementor CSS file in Head
View functions.php
add_action( 'wp_enqueue_scripts', function() {
if ( ! class_exists( 'Elementor\Core\Files\CSS\Post' ) ) {
return;
}
// Add your header page id here.
$header_page_id = 3499;
$css_file = new Elementor\Core\Files\CSS\Post( $header_page_id );
$css_file->enqueue();
@Balachandark
Balachandark / functions.php
Created Oct 24, 2019
Remove CSS style coming from custom fonts
View functions.php
// Remove CSS style coming from custom fonts.
add_action( 'wp', 'remove_styles' );
function remove_styles() {
if( class_exists( 'Bsf_Custom_Fonts_Render' ) ) {
remove_action( 'wp_head', array( Bsf_Custom_Fonts_Render::get_instance(), 'add_style' ) );
}
}
@Balachandark
Balachandark / functions.php
Last active Oct 30, 2019
Add content before, after content and in between paragraphs
View functions.php
//Insert ads after fifth and seventh paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
// Add your after 5th paragraph ad code first and then the 7th paragraph ads code.
$ad_code = array(
'<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Mypt3 300x250 (M) -->
<ins class="adsbygoogle"