This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Disable CORS for Specific URL | |
* Description: Disables CORS headers for a specific URL in WordPress. | |
* Author: Your Name | |
* Version: 1.0 | |
*/ | |
add_action('send_headers', function () { | |
// Get the current URL path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base = "https://example.com"; | |
const statusCode = 301; | |
async function handleRequest(request) { | |
const url = new URL(request.url); | |
let { pathname } = url; | |
// Split the pathname into parts using '/' | |
var parts = pathname.split('/'); | |
var firstPart = parts[1]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Important actions related to core functionality */ | |
// to remove admin bar for non admin | |
add_action('init','remove_admin_bar'); | |
function remove_admin_bar() { | |
if (!current_user_can('manage_options')) { | |
add_filter('show_admin_bar', '__return_false'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WP CLI commands for deleting Gravity form entries. | |
* Plugin URI: https://brainstormforce.com | |
* Description: Register WP CLI command to delete Gravity form entries. | |
* Version: 0.0.1 | |
* Author: Brainstorm Force | |
* Author URI: https://brainstormforce.com | |
* Text Domain: bsf | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this line in your theme's functions.php. | |
add_filter( 'astra_woo_shop_product_categories', 'display_primary_category_on_shop', 10, 2 ); | |
function display_primary_category_on_shop( $categories_html, $product_id ) { | |
$terms = get_the_terms( $product_id, 'product_cat' ); | |
if( ! empty( $terms ) ) { | |
$primary_category = get_post_meta( $product_id, '_yoast_wpseo_primary_product_cat', true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not add this line in your theme's functions.php | |
add_filter( 'astra_get_option_shop-off-canvas-trigger-type', function( $value ) { | |
if( function_exists( 'is_shop' ) && is_shop() ) { | |
return 'disable'; | |
} | |
return $value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this line in functions.php | |
add_filter( 'astra_single_post_navigation_enabled', '__return_false' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this line in your functions.php | |
add_filter( 'astra_excerpt_type', 'ast_modify_excerpt_type' ); | |
function ast_modify_excerpt_type( $excerpt_type ) { | |
$excerpt_type = astra_get_option( 'blog-post-content' ); | |
return $excerpt_type; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Do not include this line in your functions.php file. | |
add_filter( 'astra_blog_template_name', function( $name ) { | |
// Replace `block` with your category slug. | |
if( is_category( 'block' ) ) { | |
return 'block'; | |
} | |
// For category with slug "book". You need to add template file `blog-layout-book.php` file to get this work. |
NewerOlder