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 random_password( $length = 8 ) { | |
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; | |
$password = substr( str_shuffle( $chars ), 0, $length ); | |
return $password; | |
} | |
?> |
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
add_filter( 'product_vendors_vendor_slug', 'change_vendor_url_slug' ); | |
function change_vendor_url_slug( $slug ) { | |
$slug = 'new_url'; | |
return $slug; | |
} |
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 | |
add_filter( 'dashboard_glance_items', 'custom_glance_items', 10, 1 ); | |
function custom_glance_items( $items = array() ) { | |
$post_types = array( 'post_type_1', 'post_type_2' ); | |
foreach( $post_types as $type ) { | |
if( ! post_type_exists( $type ) ) continue; |
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 | |
$str = "String to loop through" | |
$strlen = strlen( $str ); | |
for( $i = 0; $i <= $strlen; $i++ ) { | |
$char = substr( $str, $i, 1 ); | |
// $char contains the current character, so do your processing here | |
} | |
?> |
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
add_filter( 'ssp_show_episode_details', '__return_false' ); |
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
function role_exists( $role ) { | |
if( ! empty( $role ) ) { | |
return $GLOBALS['wp_roles']->is_role( $role ); | |
} | |
return false; | |
} |
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 | |
class Tag_Checklist { | |
private $taxonomy; | |
private $post_type; | |
function __construct( $taxonomy, $post_type ) { | |
$this->taxonomy = $taxonomy; | |
$this->post_type = $post_type; |
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 | |
add_action( 'add_meta_boxes', 'listing_image_add_metabox' ); | |
function listing_image_add_metabox () { | |
add_meta_box( 'listingimagediv', __( 'Listing Image', 'text-domain' ), 'listing_image_metabox', 'post', 'side', 'low'); | |
} | |
function listing_image_metabox ( $post ) { | |
global $content_width, $_wp_additional_image_sizes; | |
$image_id = get_post_meta( $post->ID, '_listing_image_id', true ); |
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
/** | |
* Only show current vendor's media in the media library | |
* @param array $request Default request arguments | |
* @return array Modified request arguments | |
*/ | |
add_filter( 'request', 'pv_restrict_media_library', 10, 1 ); | |
function pv_restrict_media_library( $request = array() ) { | |
if( ! is_admin() ) { | |
return $request; |
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 | |
add_filter( 'ssp_bible_readings_version', 'my_bible_version', 10, 2 ); | |
function my_bible_version ( $version, $episode_id ) { | |
$version = 'NKJV'; // All available versions are listed here: https://www.biblegateway.com/versions/ | |
return $version; | |
} | |
?> |