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 | |
/** | |
* Get the excerpt for a WP_Post by post ID. | |
* | |
* @param int $post_id | |
*/ | |
function get_excerpt_by_id( $post_id = 0 ) { | |
global $post; | |
$save_post = $post; |
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 | |
/** | |
* Class My_Shortcode | |
*/ | |
class My_Shortcode { | |
/** | |
* The shortcode attributes | |
* |
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 | |
/** | |
* Custom shortcode callback function | |
* | |
* @param array $atts | |
* @param string $content | |
* @return string | |
*/ | |
function my_shortcode_callback( $atts = array(), $content = '' ) { |
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 | |
/** | |
* WP-CLI script for moving a multi-site instance from one domain to another | |
* | |
* Example command usage: wp eval-file multisite-migrate.php old-domain.com new-domain.com | |
* Note: Currently, this script doesn't update all domain references, such as in post content. | |
* At this time, it is primarily used when creating a local copy of a multi-site instance in | |
* order to ensure everything will load on a local dev domain. | |
*/ |
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 | |
/** | |
* Filter an array based on a white list of keys | |
* | |
* @param array $array | |
* @param array $keys | |
* @return array | |
*/ | |
function array_keys_white_list( array $array, array $keys ) { |
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 | |
/** | |
* Filter an array based on a black list of keys | |
* | |
* @param array $array | |
* @param array $keys | |
* @return array | |
*/ | |
function array_keys_black_list( array $array, array $keys ) { |
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 | |
/** | |
* Properly set the timezone in WordPress | |
* | |
* @param string $timezone | |
*/ | |
public static function set_timezone( $timezone = '' ) { | |
if ( empty( $timezone ) ) { | |
$timezone = get_option( 'timezone_string', date_default_timezone_get() ); |
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 | |
/** | |
* Class Attachment_Query | |
*/ | |
class Attachment_Query extends WP_Query { | |
function __construct( $query = '' ) { | |
$defaults = array( | |
'post_type' => 'attachment', |
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
echo "<?php" > salt.php | |
wget https://api.wordpress.org/secret-key/1.1/salt/ -O - >> salt.php |
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 | |
/** | |
* Class Custom_Page_Templates | |
*/ | |
class Custom_Page_Templates { | |
/** | |
* Storage for all custom template paths | |
* |