Skip to content

Instantly share code, notes, and snippets.

View shubhw12's full-sized avatar
🎯
Focusing

Shubham Wagh shubhw12

🎯
Focusing
  • Pune
View GitHub Profile
@shubhw12
shubhw12 / pagination.php
Created January 29, 2020 10:34
To get page pagination on the top of the archive pages
add_action('astra_archive_header','function_call_astra_number' );
function function_call_astra_number() {
astra_number_pagination();
}
function astra_number_pagination() {
global $numpages;
$enabled = apply_filters( 'astra_pagination_enabled', true );
$numpages = 1;
@shubhw12
shubhw12 / gist:5e4d550a648f91496ca5fca1ace01394
Created February 4, 2020 13:53
Remove the author link in from the archive page meta. Can paste the code in functions.php of child theme
function astra_post_author( $output_filter = '' ) {
ob_start();
echo '<span ';
echo astra_attr(
'post-meta-author',
array(
'class' => 'posted-by vcard author',
)
@shubhw12
shubhw12 / gist:12f204c61b7d5854507a124676159816
Created February 16, 2020 14:14
display tags below post
add_filter( 'astra_post_tags', 'remove_tags_callback' );
function remove_tags_callback(){
return ' ';
}
add_action( 'astra_entry_after' , 'add_tags_callback');
function add_tags_callback(){
@shubhw12
shubhw12 / gist:645000abc7baa99d2ed0668799176a0d
Created February 28, 2020 05:48
Remove archives word from the archive pages.
add_filter('get_the_archive_title', function ($title) {
return preg_replace('/^\w+: /', '', $title);
});
@shubhw12
shubhw12 / gist:1fff5ff99434cc0b4581606029354771
Created February 28, 2020 06:35
Remove link rel attribute.
add_action('wp', 'remove_pingback');
function remove_pingback(){
remove_action('wp_head', 'astra_pingback_header');
}
@shubhw12
shubhw12 / gist:081d643fe4701f56400fba2bac42ca4b
Last active April 13, 2020 05:17
Add the quantity button next to add to cart button in astra on shop page
function custom_quantity_field_archive() {
$product = wc_get_product( get_the_ID() );
if ( ! $product->is_sold_individually() && 'variable' != $product->product_type && $product->is_purchasable() ) {
woocommerce_quantity_input( array( 'min_value' => 1, 'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity() ) );
}
}
@shubhw12
shubhw12 / gist:7cb7c94d1ce2825138fec95f3e839630
Created March 11, 2020 13:16
Add a div after the site branding div
/**
* Site Title / Logo
*
* @since 1.0.0
*/
function astra_site_branding_markup() {
?>
<div class="site-branding">
<div
<?php
@shubhw12
shubhw12 / gist:7856b0f0a41037725acedc6cf04f2eb7
Created March 27, 2020 11:46
Display post meta for custom post type in astra on single post page
add_action('astra_single_post_title_after', 'callback_function');
function callback_function(){
if ( 'post' !== get_post_type() ){
$enable_meta = apply_filters( 'astra_blog_post_meta_enabled', '__return_true' );
$post_meta = astra_get_option( 'blog-meta' );
if ( is_array( $post_meta ) && $enable_meta ) {
@shubhw12
shubhw12 / gist:1079072f1787beb307420606b7c2b726
Created March 27, 2020 14:38
Display author meta on CPT
add_action( 'astra_primary_content_bottom' , 'author_meta_callback' );
function author_meta_callback(){
if ( 'post' !== get_post_type() ){
if (function_exists('astra_get_template')){
if ( astra_get_option( 'ast-author-info' ) && is_singular( ) ) {
astra_get_template( 'blog-pro/template/author-info.php' );
}
}
}
@shubhw12
shubhw12 / gist:a2527779f4c61288cab770d68ef0866b
Created April 8, 2020 07:49
Remove author link from the post meta
add_filter('astra_post_author' , 'author_call_back', 15 );
function author_call_back(){
ob_start();
echo '<span ';
echo astra_attr(
'post-meta-author',
array(