Inventory_Presser_Shortcode_Sort_By::change_sorter_based_on_price_display()
change_sorter_based_on_price_display
Return Return
(void)
Source Source
File: includes/shortcode/class-shortcode-sort-by.php
public function change_sorter_based_on_price_display() { if ( is_admin() ) { return; } $settings = INVP::settings(); if ( ! isset( $settings['price_display'] ) ) { return; } if ( isset( $_GET['orderby'] ) && apply_filters( 'invp_prefix_meta_key', 'price' ) == $_GET['orderby'] ) { add_action( 'pre_get_posts', array( $this, 'change_price_field_when_sorting' ) ); } switch ( $settings['price_display'] ) { case 'down_only': // add down payment to the sort drop down. add_filter( 'invp_sort_dropdown_options', array( $this, 'add_down_payment_to_sort_dropdown' ) ); // and remove price. add_filter( 'invp_sort_dropdown_options', array( $this, 'remove_price_from_sort_dropdown' ) ); break; case 'call_for_price': // no prices available, remove price from the drop down. add_filter( 'invp_sort_dropdown_options', array( $this, 'remove_price_from_sort_dropdown' ) ); break; } }
Expand full source codeCollapse full source codeView on Github