Skip to content

Instantly share code, notes, and snippets.

View rushijagani's full-sized avatar
🏠
Working | Exploring | Accelerating from home

Rushi Jagani rushijagani

🏠
Working | Exploring | Accelerating from home
View GitHub Profile
@rushijagani
rushijagani / functions.php
Created July 3, 2018 13:30
Remove the Woocommerce support for zooming effect
<?php
/**
* @return remove woocommerce support for zooming effect
*/
add_action( 'after_setup_theme', 'astra_child_remove_woocommerce_support', 20 );
function astra_child_remove_woocommerce_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
}
@rushijagani
rushijagani / functions.php
Created June 29, 2018 10:18
Display some text when hovered over logo with Astra
<?php
// Add Custom Text with Logo.
add_filter( 'get_custom_logo', 'add_title_markup_with_logo' );
function add_title_markup_with_logo( $output ){
$output .= '<div class="logo-hover-overlay">';
$output .= '<div class="site-title-custom-text">Your Custom Text</div>';
$output .= '</div>';
return $output;
}
@rushijagani
rushijagani / functions.php
Created June 21, 2018 13:28
Register a new image size and filter that image size using Astra.
<?php
/**
* Register a new image size.
*
* @link https://developer.wordpress.org/reference/functions/add_image_size/
*
* your-custom-size -- Image size identifier
* 940 -- width of the image size as per your requirement.
* 540 -- width of the image size as per your requirement.
@rushijagani
rushijagani / functions.php
Created June 18, 2018 12:07
Disable Title from Pages / Posts in Astra
<?php
/**
* Disable title on all pages and posts.
*/
function your_prefix_post_title() {
$post_types = array( 'page', 'post' );
// bail early if the current post type if not the one we want to customize.
if ( ! in_array( get_post_type(), $post_types ) ) {
@rushijagani
rushijagani / functions.php
Created June 15, 2018 12:41
Default Blog / Archive and Single Blog Post sidebar applied to the Custom Post Type
<?php
/** Default Blog / Archive and Single Blog Post sidebar applied to the Custom Post Type */
add_filter( 'astra_page_layout', 'custom_post_type_custom_sidebar' );
/**
* @link https://codex.wordpress.org/Conditional_Tags
*/
function custom_post_type_custom_sidebar( $sidebar ){
$blog_archive_sidebar = astra_get_option('archive-post-sidebar-layout');
@rushijagani
rushijagani / functions.php
Created June 15, 2018 10:50
Add Last Update date just after the Published date in post meta in Astra theme
<?php
/**
* Add Last Update date just after the Published date in post meta.
*/
add_filter( 'astra_post_date', 'add_modified_date_to_post_meta' );
function add_modified_date_to_post_meta( $output ){
$modified_date = esc_html( get_the_modified_date() );
$original_time = get_the_time('U');
$modified_time = get_the_modified_time('U');
@rushijagani
rushijagani / functions.php
Created June 15, 2018 09:38
Add Read More text after the excerpt (Only Excerpts which are the hand-crafted summaries of your content ).
<?php
// Add "Read More" link to excerpts only (Excerpts which are the hand-crafted summaries of your content ))
add_filter('get_the_excerpt', 'custom_excerpt_read_more_link');
function custom_excerpt_read_more_link($excerpt) {
$excerpt_more = '';
$read_more_text = 'Read More &raquo;';
if ( has_excerpt() && ! is_attachment() && get_post_type() == 'post' ) {
$excerpt_more = '<p class="read-more" ><a href="' . esc_url( get_permalink() ) . '"> '. $read_more_text . '</a></p>';
}
@rushijagani
rushijagani / functions.php
Created June 14, 2018 14:09
Remove Author link from Post in Astra.
<?php
/**
* Disable Author Archive link from Post Meta.
*/
add_filter( 'astra_post_author', 'your_author_meta_update' );
function your_author_meta_update( $output ){
$author_info = sprintf(
@rushijagani
rushijagani / comments.php
Created June 12, 2018 13:53
Compatibility with Subtitle plugin
<?php
/**
* The template for displaying comments.
*
* This is the template that displays the area of the page that contains both the current comments
* and the comment form.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Astra
@rushijagani
rushijagani / functions.php
Created June 11, 2018 09:33
Add Previous / next lesson links to the Lifter LMS.
<?php
/**
* Add Default Previuos / Next lesson pagination to the lesson template of Lifter LMS
*/
add_action( 'wp', 'add_lifter_lesson_navigation' );
function add_lifter_lesson_navigation(){
if ( class_exists( 'LifterLMS' ) ) {
if ( is_lesson() ) {