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 | |
// Check if get_plugins() function exists. This is required on the front end of the | |
// site, since it is in a file that is normally only loaded in the admin. | |
// This snippet adds a shortcode to wordpress which will list all plugins | |
function tradesouthwest_custom_listtall_plugins() | |
{ | |
if ( ! function_exists( 'get_plugins' ) ) { | |
require_once ABSPATH . 'wp-admin/includes/plugin.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 | |
/** | |
* Only show nickname if not admin | |
* | |
* @since 1.0.0 | |
* | |
* TODO option to toggle | |
*/ | |
function vertycal_maybe_show_nickname( $author ) | |
{ |
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 | |
/** | |
* This function modifies the main WordPress query to include an array of | |
* post types instead of the default 'post' post type. | |
* | |
* @param object $query The original query. | |
* @return object $query The amended query. | |
*/ | |
function trunkline_custom_search_query( $query ) { |
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
function tradesouthwest_nonce_test() | |
{ | |
do_action( 'check_admin_referer', $action, $result); | |
if( !$result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) { | |
wp_nonce_ays( $action ); | |
die(); | |
} | |
return $result; | |
} |
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 | |
//gets all products to put in dropdown in admin settings page | |
function meprprorata_products_dropdown_cb($args, $access= array()) | |
{ | |
//$available = new MeprCouponsHelper::products_dropdown(); | |
$access = is_array($access) ? $access : array(); | |
$contents = array(); | |
$posts = MeprCptModel::all('MeprProduct'); |
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 | |
/** | |
* LearnDash filter to prevent converting answer values to lowercase | |
* | |
* @possibly use ld_adv_quiz_pro_ajax() | |
* @uses stripslashes( strtolower( trim( $userResponse ) ) ) Default | |
* @since 1.0 | |
* @from WpProQuiz_View_FrontQuiz.php | |
* post_type=sfwd-quiz | |
*/ |
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 | |
//From: https://github.com/oyina/Note-Taker/blob/master/note.php | |
//Retreives Post Id from Meta Key | |
function get_post_id_by_meta_key_and_value($key, $value) { | |
global $wpdb; | |
$meta = $wpdb->get_results("SELECT * FROM `".$wpdb->postmeta."` WHERE meta_key='".$wpdb->escape($key)."' | |
AND meta_value='".$wpdb->escape($value)."'"); | |
if (is_array($meta) && !empty($meta) && isset($meta[0])) { | |
$meta = $meta[0]; | |
} |
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
add_filter( 'gettext', 'misha_change_text_with_gettext', 20, 3 ); | |
function misha_change_text_with_gettext( $translated_text, $text, $domain ) { | |
if ( is_admin() | |
&& isset($_GET['post']) | |
&& get_post_type( $_GET['post'] ) == 'shop_order' | |
&& $domain == 'woocommerce' ) { | |
if( $translated_text == 'Shipping' ) { |
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 all blog ids of blogs in the current network that are: | |
* - not archived | |
* - not spam | |
* - not deleted | |
* | |
* | |
* @return array|false The blog ids, false if no matches. | |
*/ |
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
/** | |
* print custom post type category list | |
* @cpt name= hordes | |
* @taxonomy name= hordes-category | |
*/ | |
if ( ! function_exists( 'theme_entry_footer_cat_list' ) ) : | |
function theme_entry_footer_cat_list() { | |
// Get custom taxonomy project_category for each specific CPT | |
if ( 'hordes' === get_post_type() ) { |