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 | |
function is_image_url_crop( string $image_url ) : bool { | |
// Check if this is an intermediate size image. | |
preg_match( '/-(\d+)x(\d+)\./', $image_url, $matches ); | |
if ( ! empty( $matches[0] ) ) { | |
return 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 | |
/** | |
* Alters the default post permalink structure to be: | |
* | |
* `/{primary-category}/{post-slug}/` | |
*/ | |
/** | |
* The Primary_Category_Post_URL class. | |
*/ |
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 | |
/** | |
* Customize user roles. | |
*/ | |
/** | |
* Class User_Roles. | |
*/ | |
class User_Roles { | |
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 | |
/** | |
* The class used to make certain taxonomies have a top level URL. | |
*/ | |
/** | |
* The Taxonomy_Top_Level_URL class. | |
*/ | |
class Taxonomy_Top_Level_URL { | |
/** |
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
// Globally hide the TinyMCE media buttons so that we can alter them and show them | |
// once updated. | |
.wp-media-buttons { | |
display: none; | |
} |
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 | |
/** | |
* Trait file for Singletons. | |
*/ | |
/** | |
* Make a class into a singleton. | |
*/ | |
trait Singleton { | |
/** |
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 local date with a specific format. | |
* | |
* @param string $timestamp UNIX timestamp. | |
* @param string $format Date format. | |
* @return string Local date string. | |
*/ | |
function get_local_date( $timestamp, $format = null ) { | |
if ( empty( $format ) ) { |
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 | |
/** | |
* Add custom post filters on the All Posts page. This is best used with an Elastic | |
* Search powered site since this can create a very expensive query. | |
* | |
* Simple Example: | |
* | |
* add_filter( 'all_post_filters', function ( $filters, $post_type ) { | |
* // Perform post type validiation. |
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 | |
/** | |
* Retrieves the image ids from a gallery. | |
* | |
* @param int|WP_Post $post Post ID or object. | |
* @return array An array of image ids. | |
*/ | |
function get_gallery_image_ids( $post ) { | |
$post = get_post( $post ); | |
if ( ! $post ) { |
NewerOlder