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
// Utility function to change the prices with a multiplier (number) | |
function get_price_multiplier() { | |
$prod_id = get_the_ID(); | |
$brand = 'acme'; | |
if ( (is_user_logged_in()) && ($brand == 'acme') ) { | |
return 0.8; // 20% off | |
} else { |
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
$dump = what_I_want_to_dump(); | |
print("<pre>".print_r($dump,true)."</pre>"); |
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_action( 'wp_head', 'cvl_add_facetwp_fwp_http', 100 ); | |
function cvl_add_facetwp_fwp_http() { | |
if (is_singular('job_listing')) { | |
global $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_filter( 'facetwp_query_args', function( $query_args, $class ) { | |
$parent = get_the_ID(); | |
if ( 'example' == $class->ajax_params['template'] ) { | |
$query_args['post_parent'] = $parent; | |
$query_args['post_type'] = 'job_application'; | |
$query_args['post_status'] = 'published'; |
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 | |
$args = array( | |
// Arguments for your query. | |
); | |
// Custom query. | |
$query = new WP_Query( $args ); | |
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('login_redirect', 'admin_login_redirect', 10, 3); | |
function admin_login_redirect( $redirect_to, $request, $user ) { | |
global $user; | |
if( isset( $user->roles ) && is_array( $user->roles ) ) { | |
if( in_array( 'administrator', $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
add_filter( 'gform_pre_render_FORM_ID', 'dna_user_list_dropdown' ); | |
add_filter( 'gform_pre_validation_FORM_ID', 'dna_user_list_dropdown' ); | |
add_filter( 'gform_pre_submission_filter_FORM_ID', 'dna_user_list_dropdown' ); | |
add_filter( 'gform_admin_pre_render_FORM_ID', 'dna_user_list_dropdown' ); | |
function dna_user_list_dropdown( $form ) { | |
foreach ( $form['fields'] as &$field ) { |
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
/* | |
* Source | |
* https://code.tutsplus.com/articles/how-to-disable-the-admin-bar-in-wordpress-33--wp-23361 | |
*/ | |
if (!function_exists('disableAdminBar')) { | |
function disableAdminBar(){ | |
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
.selector:not(:last-child) { | |
/* styles for everything except last item */ | |
} |
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 | |
/** | |
* vpm_default_hidden_meta_boxes | |
* Source: https://www.vanpattenmedia.com/2014/code-snippet-hide-post-meta-boxes-wordpress | |
*/ | |
function vpm_default_hidden_meta_boxes( $hidden, $screen ) { | |
// Grab the current post type | |
$post_type = $screen->post_type; | |
// If we're on a 'post'... | |
if ( $post_type == 'post' ) { |
NewerOlder