This file contains 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 | |
/** | |
* Optimize Loading Separate Core Block Assets in Classic Themes Plugin. | |
* | |
* @package OptimizeLoadingSeparateCoreBlockAssetsInClassicThemes | |
* @author Weston Ruter | |
* @link https://gist.github.com/westonruter/25187db63a7666f08b151ca53497ffb5 | |
* @license GPL-2.0-or-later | |
* @copyright 2023 Google Inc. | |
* |
This file contains 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 | |
// Put this in wp-config.php and replace https://example.com/ with the URL of the production site. | |
define( 'RH_USE_REMOTE_MEDIA_URL', 'https://example.com/' ); | |
// Put the rest of this in functions.php or a custom plugin or somewhere else. | |
if ( defined( 'RH_USE_REMOTE_MEDIA_URL' ) && ! empty( RH_USE_REMOTE_MEDIA_URL ) ) { | |
add_filter( 'wp_get_attachment_image_src', 'filter_wp_get_attachment_image_src' ); | |
add_filter( 'wp_calculate_image_srcset', 'filter_wp_calculate_image_srcset' ); | |
add_filter( 'wp_get_attachment_url', 'filter_wp_get_attachment_url' ); | |
} |
This file contains 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 | |
function my_rating( $atts ) { | |
$rating = shortcode_atts( array( | |
'stars' => '', | |
'half' => 'false', | |
), $atts ); | |
$star = esc_attr($rating['stars']); | |
$stars = str_repeat('<i class="fas fa-fw fa-star"></i>', $star); | |
$half = esc_attr($rating['half']); |
This file contains 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 | |
/* | |
############################## | |
########### Search ########### | |
############################## | |
Included are steps to help make this script easier for other to follow | |
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10 | |
[list_searcheable_acf list all the custom fields we want to include in our search query] | |
@return [array] [list of custom fields] |
This file contains 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 //* mind this opening php tag | |
//* Make Admin Comments Become Author Comments | |
add_filter( 'preprocess_comment', 'rv_admin_comments_to_author_comments' ); | |
function rv_admin_comments_to_author_comments( $comment_data ) { | |
if ( $comment_data['user_ID'] == 1 ) { // Change 1 to your admin ID | |
$comment_data['user_ID'] = 8; // Change 8 to your Author ID | |
$comment_data['comment_author'] = 'Your Name'; // Enter the name you want to appear in comments |
This file contains 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
/** | |
* This gist demonstrates how to properly load jQuery within the context of WordPress-targeted JavaScript so that you don't | |
* have to worry about using things such as `noConflict` or creating your own reference to the jQuery function. | |
* | |
* @version 1.0 | |
*/ | |
(function( $ ) { | |
"use strict"; | |
$(function() { |