Skip to content

Instantly share code, notes, and snippets.

View premanshup's full-sized avatar
🔺
Decode the code

Premanshu Pandey premanshup

🔺
Decode the code
View GitHub Profile
@premanshup
premanshup / index.html
Created December 27, 2023 08:08
Floating UI: autoPlacement demo
<!doctype html>
<html>
<head>
<title>Floating UI Tutorial</title>
<style>
body {
display: flex;
height: 100vh;
}
@premanshup
premanshup / functions.php
Created August 3, 2021 17:12
Astra - Disable "Reading time" on specific blog posts
add_action( 'init', 'astra_remove_read_time_filter', 11 );
function astra_remove_read_time_filter() {
$obj = Astra_Ext_Blog_Pro_Markup::get_instance();
remove_filter( 'astra_meta_case_read-time', array( $obj, 'reading_time_content' ), 10, 3 );
}
add_filter( 'astra_meta_case_read-time', 'astra_override_reading_time', 10, 3 );
function calculate_reading_time( $post_id ) {
@premanshup
premanshup / functions.php
Created May 1, 2021 07:51
"Related Posts" - change title to custom title - Add this in Astra child theme's functions.php file
add_filter( 'astra_related_posts_title', 'astra_change_related_posts_title' );
function astra_change_related_posts_title( $title ) {
$custom_title = 'Your Custom Title';
return str_replace( 'Related Posts', $custom_title, $title );
}
@premanshup
premanshup / functions.php
Created March 2, 2021 15:21
Dequeue Astra Theme Static CSS
add_action( 'wp_enqueue_scripts', 'dequeue_astra_css' );
function dequeue_astra_css() {
wp_dequeue_style( 'astra-theme-css' );
}
@premanshup
premanshup / functions.php
Created February 2, 2021 14:04
WooCommerce - Change Terms & Conditions text for Checkout Page - Astra Child Theme
add_filter( 'woocommerce_get_terms_and_conditions_checkbox_text', 'astra_change_terms_text_checkout_page' );
function astra_change_terms_text_checkout_page( $text ) {
$text = 'This is my new text for Terms and Condition on Checkout Page.';
return $text;
}
@premanshup
premanshup / functions.php
Created August 19, 2020 11:45
Change markup for Site Identity
function astra_site_branding_markup() {
?>
<!-- My Custom Markup -->
<div class="site-branding">
<div
<?php
echo astra_attr(
'site-identity',
array(
'class' => 'ast-site-identity',
@premanshup
premanshup / google-new-fonts.php
Last active July 13, 2020 11:57
New Google Fonts PHP file.
<?php
/**
* Google fonts array file.
*
* @package Astra Child
* @author Astra
* @copyright Copyright (c) 2020, Astra
* @link https://wpastra.com/
*/
@premanshup
premanshup / style.css
Last active June 17, 2020 05:50
CSS for compatibility with Gutenberg Group and Cover blocks.
@media (min-width: 1200px) {
/* With container - Sidebar/No Sidebar */
.ast-separate-container.ast-right-sidebar .entry-content .wp-block-group.alignwide,
.ast-separate-container.ast-left-sidebar .entry-content .wp-block-group.alignwide,
.ast-separate-container.ast-right-sidebar .entry-content .wp-block-cover.alignwide,
.ast-separate-container.ast-left-sidebar .entry-content .wp-block-cover.alignwide,
.ast-no-sidebar.ast-separate-container .entry-content .wp-block-group.alignwide,
.ast-no-sidebar.ast-separate-container .entry-content .wp-block-cover.alignwide {
margin-left: -20px;
margin-right: -20px;
@premanshup
premanshup / page-location.php
Created June 12, 2020 13:21
Add Page template for custom page - Location
<?php
/**
* Template Name: Location
*/
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
@premanshup
premanshup / functions.php
Created June 10, 2020 14:39
Display WooCommerce Single Products in same category.
function astra_next_post_link_product($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
adjacent_post_link_product($format, $link, $in_same_cat, $excluded_categories, false);
}
function astra_previous_post_link_product($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
adjacent_post_link_product($format, $link, $in_same_cat, $excluded_categories, true);
}
function adjacent_post_link_product( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true ) {
if ( $previous && is_attachment() )