Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Nikhil Nikschavan

View GitHub Profile
View astra-post-date-updated.php
<?php // don't copy this line in your code
/**
* Display only last modified date in the post metadata.
*
* @param String $output Markup for the last modified date.
* @return void
*/
function your_prefix_post_date( $output ) {
$output = '';
@Nikschavan
Nikschavan / remove-Organization-schema-astra.php
Created Sep 5, 2018
Remove Organization schema from Astra Theme
View remove-Organization-schema-astra.php
<?php // don't copy this line in your code.
add_action('init', 'your_prefix_setup_actions' );
function your_prefix_setup_actions() {
remove_action( 'astra_masthead_content', 'astra_site_branding_markup', 8 );
add_action( 'astra_masthead_content', 'your_prefix_header_markup', 8 );
}
function your_prefix_header_markup() {
@Nikschavan
Nikschavan / post-navigation-same-category.php
Created Aug 21, 2018
Load Next and Previous from same category (term) - Astra Theme
View post-navigation-same-category.php
<?php // don't copy this line in your code.
function previous_posts_from_same_category( $args ) {
$args['in_same_term'] = true;
return $args;
}
add_filter( 'astra_single_post_navigation', 'previous_posts_from_same_category' );
@Nikschavan
Nikschavan / update-typekit-js.php
Created Aug 18, 2018
Load Typekit JS from child theme so that it can be modified - https://wordpress.org/plugins/custom-typekit-fonts/
View update-typekit-js.php
<?php // don't copy this line your code
if ( is_callable( 'Custom_Typekit_Fonts_Render::get_instance' ) ) {
remove_action( 'wp_head', array( Custom_Typekit_Fonts_Render::get_instance(), 'typekit_embed_head' ) );
add_action( 'wp_head', 'your_prefix_typekit_embed_head' );
}
function your_prefix_typekit_embed_head() {
$kit_info = get_option( 'custom-typekit-fonts' );
if ( empty( $kit_info['custom-typekit-font-details'] ) ) {
@Nikschavan
Nikschavan / woocommerce-product-gallery-thumbnails-dimensions.php
Created Aug 16, 2018
Change the thumbnail size of the WooCommerce product gallery
View woocommerce-product-gallery-thumbnails-dimensions.php
@Nikschavan
Nikschavan / astra-extra-google-font-variants.php
Created Aug 10, 2018
Load Extra font variants in Astra Google Fonts.
View astra-extra-google-font-variants.php
<?php // don't copy this line in your code
/**
* Load extra font weights in Astra Google fonts.
* This example loads extra variannts for the Open Sans font.
*
* @param Array $fonts Fonts selected in customizer.
* @return Array Fonts array updated with more font variants to be loaded.
*/
function your_prefix_astra_more_font_weights( $fonts ) {
@Nikschavan
Nikschavan / astra-post-title-instead-of-next-previous.php
Created Aug 10, 2018
Astra - Post title instead of next previous arrows
View astra-post-title-instead-of-next-previous.php
<?php // don't copy this line in your code.
function your_prefix_next_previous_post_titles() {
return array(
'next_text' => get_the_title( get_next_post() ) . ' <span class="ast-right-arrow">&rarr;</span>',
'prev_text' => '<span class="ast-left-arrow">&larr;</span> ' . get_the_title( get_previous_post() ),
);
}
@Nikschavan
Nikschavan / change-post-type-label.php
Last active Aug 8, 2018
Change label of a post type in WordPress using filter.
View change-post-type-label.php
<?php // don't copy this line in your code
function your_prefix_change_post_type_slug( $args, $post_type ) {
if ( 'sfwd-topic' == $post_type ) {
$args['labels']['name'] = 'LD Topics';
}
return $args;
}
@Nikschavan
Nikschavan / woocommerce-product-gallery-thumbnails-dimensions.php
Created Jul 27, 2018
Change WooCommerce product gallery image thumbnail dimensions
View woocommerce-product-gallery-thumbnails-dimensions.php
@Nikschavan
Nikschavan / disable-post-navigation.php
Created Jun 4, 2018
Astra - Disable Next/Previous post navigation for specific post type
View disable-post-navigation.php
<?php // don't copy this line in your code.
/**
* Disable Next/Previous post links on specific post ttype.
* Change `your-post-type` to your post-type slug.
*
* @param Boolean $status true - If the navigation is displayed. False - If navigation is disabled.
* @return Boolean $status true - If the navigation is displayed. False - If navigation is disabled.
*/
function your_prefix_next_prev_links( $status ) {
You can’t perform that action at this time.