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 / header.html
Created September 16, 2020 10:26
Simple Header HTML markup with ARIA(Accessible Rich Internet Applications)
<header class="header-group" role="banner">
<div class="header-inner">
<div class="header-titles-wrapper">
<div class="header-titles">
<!-- .site-title or .site-logo -->
<h1 class="site-title">
<a href="#">Site Title</a>
</h1>
<!-- .site-description -->
<div class="site-description">Site Description</div>
@rushijagani
rushijagani / functions.php
Created October 19, 2018 11:07
Override Custom Post Type template
<?php
add_action( 'astra_content_loop', 'custom_post_type_loop_callback' );
function custom_post_type_loop_callback(){
if( "movies" == get_post_type() ) {
remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_default' ) );
remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_post' ) );
if ( is_singular( "movies" ) ) {
add_filter( 'astra_post_link', '__return_false' );
}
@rushijagani
rushijagani / functions.php
Created September 24, 2018 11:39
Display a specific product tag on shop/category archive page.
<?php
// Display a specific product tag on shop/category archive page.
add_action( 'woocommerce_before_shop_loop_item', 'woocommerce_poruct_tags_before_shop_loop', 7 );
function woocommerce_poruct_tags_before_shop_loop(){
// get product_tags of the current product
$current_tags = get_the_terms( get_the_ID(), 'product_tag' );
//only start if we have some tags
if ( $current_tags && ! is_wp_error( $current_tags ) ) {
@rushijagani
rushijagani / functions.php
Created September 14, 2018 12:45
Remove published date from Post meta from Astra
<?php
/**
* Function to get Date of Post without published date.
*/
if ( ! function_exists( 'astra_post_date' ) ) {
/**
* Function to get Date of Post
@rushijagani
rushijagani / functions.php
Created August 24, 2018 13:07
Add secondary logo for for a specific pages.
<?php
/** Add secondary logo for for a specific pages. */
add_filter( 'get_custom_logo', 'custom_secondary_logo_callback' );
/**
* @link https://codex.wordpress.org/Conditional_Tags
*/
function custom_secondary_logo_callback( $logo ){
$your_custom_logo = "Your Custom Logo";// Add your custom logo maerkup instead.
// is_singular() find more conditional tags from here -- https://codex.wordpress.org/Conditional_Tags
@rushijagani
rushijagani / functions.php
Last active August 1, 2018 05:28
Enqueue external styles in child themes
<?php
// enqueue styles for child theme
function example_enqueue_styles() {
// enqueue parent styles
// Add style.css inside the /assets/css/ directory.
wp_enqueue_style('parent-theme', get_template_directory_uri() .'/assets/css/style.css');
}
add_action('wp_enqueue_scripts', 'example_enqueue_styles');
@rushijagani
rushijagani / functions.php
Created July 26, 2018 08:05
Instead default Astra Post's navigation use Previous Post Link function
<?php
// Remove default Astra Post's Pagination.
remove_action( 'astra_entry_after', 'astra_single_post_navigation_markup' );
// Add Previous Post| Next Post Link for Post's Pagination.
add_action( 'astra_entry_after', 'astra_single_post_custom_navigation_markup' );
function astra_single_post_custom_navigation_markup() {
$single_post_navigation_enabled = apply_filters( 'astra_single_post_navigation_enabled', true );
@rushijagani
rushijagani / functions.php
Created July 20, 2018 07:01
Update the featured images size from Astra.
<?php
/**
* Update the featured images size from Astra
*/
add_filter( 'astra_post_thumbnail_default_size', 'update_featured_images_size_callback' );
function update_featured_images_size_callback( $size ) {
$size = array( 500, 500 ); // Update the 500(Width), 500(Height) as per your requirment.
return $size;
}
@rushijagani
rushijagani / functions.php
Created July 18, 2018 06:21
Add cotnent above the Archive page and Single post title before in Astra
<?php
/**
* Add cotnent above the Archive page's each post's title before
*/
add_action( 'astra_archive_post_title_before', 'astra_child_add_content_before_archive_post_title' );
function astra_child_add_content_before_archive_post_title() {
echo "Add Your content before the archive pages post title";
}
@rushijagani
rushijagani / functions.php
Last active May 20, 2022 16:37
Show all the categories list for each product on the shop page in Astra.
<?php
/**
* Shop page - Show all categories for each product on shop page
*/
if ( ! function_exists( 'astra_woo_shop_parent_category' ) ) :
function astra_woo_shop_parent_category() {
if ( apply_filters( 'astra_woo_shop_parent_category', true ) ) : ?>
<span class="ast-woo-product-category">
<?php