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_action( 'init', function() { | |
| global $wp_post_statuses; | |
| if ( ! is_array( $wp_post_statuses ) ) { | |
| $wp_post_statuses = []; | |
| } | |
| // @todo: make 'public' status optional, so expired listings can also be accessed from url (optionally). | |
| if ( ! empty( $wp_post_statuses['expired'] ) ) { | |
| $wp_post_statuses['expired']->public = 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 | |
| $images = get_post_meta( get_the_ID(), 'images', true ); | |
| if ( $images ) { | |
| for( $i = 0; $i < $images; $i++ ) { | |
| $image_name = get_post_meta( get_the_ID(), 'images_' . $i . '_image_name', true ); | |
| $image_path = get_post_meta( get_the_ID(), 'images_' . $i . '_image_path', 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 | |
| /** | |
| * Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field | |
| * | |
| * Preview your Gravity forms on the frontend of your website. Adds a "Live Preview" link to the Gravity Forms toolbar. | |
| * | |
| * Usage | |
| * | |
| * 1 - Enable "Allow field to be populated dynamically" option on field which should be populated. | |
| * 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this 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
| <?php | |
| $args = array( | |
| 'post_status'=>'publish', | |
| 'post_type'=>array(TribeEvents::POSTTYPE), | |
| 'posts_per_page'=>10, | |
| //order by startdate from newest to oldest | |
| 'meta_key'=>'_EventStartDate', | |
| 'orderby'=>'_EventStartDate', | |
| 'order'=>'DESC', |
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 | |
| /*-------------------------------------------------------*/ | |
| /* Default to List View When Viewing Event Categories | |
| /*-------------------------------------------------------*/ | |
| add_action( 'pre_get_posts', 'default_to_list_view' ); | |
| function default_to_list_view( $query ) { | |
| if ( is_tax(TribeEvents::TAXONOMY) && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && empty( $query->query_vars['suppress_filters'] ) ) { | |
| $query->set( 'eventDisplay', 'upcoming' ); |
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 // do not copy this line | |
| function rewrite_wc_bookings_get_time_slots_html( $block_html, $available_blocks, $blocks ) { | |
| $block_html = ''; | |
| foreach ( $available_blocks as $block => $quantity ) { | |
| if ( $quantity['available'] > 0 ) { | |
| $block_html .= '<li class="block" data-block="' . esc_attr( date( 'Hi', $block ) ) . '"><a href="#" data-value="' . date( 'G:i', $block ) . '">' . date_i18n( get_option( 'time_format' ), $block ) . ' <small class="booking-spaces-left">(' . sprintf( _n( '%d left', '%d left', $quantity['available'], 'woocommerce-bookings' ), absint( $quantity['available'] ) ) . ')</small></a></li>'; | |
| } |
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 copy this line if needed | |
| // related blog post: https://jessepearson.net/2016/11/woocommerce-bookings-cod-payments/ | |
| /** | |
| * Function that will put bookings into a Confirmed status if they were paid for via COD | |
| * | |
| * @param int/string $order_id The order id | |
| * @return null | |
| */ | |
| function lets_confirm_some_cod_bookings( $order_id ) { | |
| global $wpdb; |
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( 'um_account_page_default_tabs_hook', 'factmaven_um_tabs', 100 ); | |
| add_action( 'um_account_tab__tab1', 'factmaven_um_tab_hook_tab1' ); | |
| add_action( 'um_account_tab__tab2', 'factmaven_um_tab_hook_tab2' ); | |
| add_filter( 'um_account_content_hook_tab1', 'factmaven_account_content_hook_tab1' ); | |
| add_filter( 'um_account_content_hook_tab2', 'factmaven_account_content_hook_tab2' ); | |
| // ULTIMATE MEMBER | |
| function factmaven_um_tabs( $tabs ) { // Add Tab #1 tab |
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 custom fields query to WP REST API v2 | |
| // https://1fix.io/blog/2015/07/20/query-vars-wp-api/ | |
| function my_allow_meta_query( $valid_vars ) { | |
| $valid_vars = array_merge( $valid_vars, array( 'meta_key', 'meta_value' ) ); | |
| return $valid_vars; | |
| } | |
| add_filter( 'rest_query_vars', 'my_allow_meta_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 copy this line if needed | |
| function sv_wc_api_allow_acof_protected_meta() { | |
| add_filter( 'is_protected_meta', 'sv_wc_acof_is_protected_meta', 10, 2 ); | |
| } | |
| add_action( 'woocommerce_api_loaded', 'sv_wc_api_allow_acof_protected_meta' ); | |
| function sv_wc_acof_is_protected_meta( $protected, $meta_key ) { | |
| if ( 0 === strpos( $meta_key, '_wc_acof_' ) ) { |
NewerOlder