Allow SVG Files Upload (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

Shortcode to get all taxonomy values of current post

function display_post_artists_shortcode() { // Get the terms (artists) of the “artist” taxonomy for the current post $artists = get_the_terms(get_the_ID(), ‘artist’); // Check if artists exist if ($artists && !is_wp_error($artists)) { // Start building the output $output = []; // Loop…Continue reading

Build A Quote

// modify add to cart text on single add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘woo_custom_cart_button_text’ ); function woo_custom_cart_button_text( $text ) { if( has_term( ‘quote-only’, ‘product_cat’ ) ){ $text = __( ‘Build My Quote’, ‘your-plugin’ ); } return $text; } // modify add to cart…Continue reading

ai content idea generator

function openai_generate_text() { // Get the topic from the AJAX request $prompt = $_POST[‘prompt’]; $prompt =”generate 10 content ideas about ” . $topic; // OpenAI API URL and key $api_url = ‘https://api.openai.com/v1/chat/completions’; $api_key = ‘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’ ; // Replace with your…Continue reading

Remove hyperlink from name field

add_filter(‘preprocess_comment’, ‘remove_links_from_comment_author’); function remove_links_from_comment_author($commentdata) { // Regular expression to detect hyperlinks $pattern = ‘/Continue reading

Remove Recurring Donation Time Periods

/** * This snippet removes some options for recurring donation periods with Charitable’s Recurring Donations addon. * This might reset or cause odd things to happen to campaigns who resave settings without updating the period if * they already selected…Continue reading

Share test

add_filter( ‘widget_text’, ‘do_shortcode’ ); switch_to_blog(1); $output = do_shortcode(‘[jsMatchDayStat season_id=”95″ matchday_id=”45″ photo=”1″ teamname=”2″ venue=”1″ layout=”0″]’); restore_current_blog(); echo $output;Continue reading