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 | |
/** | |
* 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
<?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 | |
// 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 | |
/** | |
* Footer script to remove quick view button if vendor on vacation. | |
* @param script | |
* @author Larry Judd | Tradesouthwest | |
* The first one works the best across all browsers. The other two are for testing against other plugins. | |
*/ | |
/* | |
* If you use the .css combinator method add this to CSS stylesheet: | |
****************************************************************** |
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 | |
/** | |
* Demonstration uses all cpt posts in a dropdown field to select | |
* a featured listings to callback in a function | |
* @param $wpselected_ string References a plugin option Setting. | |
*/ | |
function wpselected_featured_listing_cb() | |
{ | |
$post_type = 'wpselected_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 | |
/** | |
* Add meta box to editor | |
* | |
* @strings $id, $title, $callback, $screen, $context, $priority, $args | |
* function's action_added in register cpt | |
*/ | |
function vertycal_date_time_meta_box() | |
{ | |
add_meta_box( |
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 | |
/** | |
* Set a constant that holds the theme's minimum supported PHP version. | |
*/ | |
define( 'THEMESLUG_MIN_PHP_VERSION', '5.6' ); | |
/** | |
* Immediately after theme switch is fired we we want to check php version and | |
* revert to previously active theme if version is below our minimum. |
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 code retrieves course data from an external API and displays it in the user's | |
* My Account area. A merchant has noticed that there's a delay when loading the page. | |
* | |
* 1) What changes would you suggest to reduce or remove that delay? | |
* 2) Is there any other code changes that you would make? | |
*/ | |
//improvements | |
/** |
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 list of all user meta | |
* @package WordPress | |
* @uses shortcode [bnsw_userprint="user_id"] Or whatever name you register | |
*/ | |
function bnswfields_user_list_meta($atts) | |
{ | |
if ( !isset( $atts['user_id'] ) ){ |