-
-
Save anonymous/4d1f57c5875eaf54ed4f23afe5e257b3 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* @package WordPress | |
* @subpackage Kleo | |
* @author SeventhQueen <themesupport@seventhqueen.com> | |
* @since Kleo 1.0 | |
*/ | |
/** | |
* Kleo Child Theme Functions | |
* Add custom code below | |
*/ | |
add_action('in_widget_form', 'spice_get_widget_id'); | |
function spice_get_widget_id($widget_instance) | |
{ | |
// Check if the widget is already saved or not. | |
if ($widget_instance->number=="__i__"){ | |
echo "<p><strong>Widget ID is</strong>: Pls save the widget first!</p>" ; | |
} else { | |
echo "<p><strong>Widget ID is: </strong>" .$widget_instance->id. "</p>"; | |
} | |
} | |
function wpse_242093_auctions($auctions) { | |
return array('Brand New' => __('Brand New', 'wc_simple_auctions'), '9/10' => __('9/10', 'wc_simple_auctions'), | |
'8/10'=> __('8/10', 'wc_simple_auctions'), '7/10'=> __('7/10', 'wc_simple_auctions'), '6/10'=> __('6/10', 'wc_simple_auctions'), '5/10'=> __('5/10', 'wc_simple_auctions'), '4/10'=> __('4/10', 'wc_simple_auctions'), '3/10'=> __('3/10', 'wc_simple_auctions'), '2/10'=> __('2/10', 'wc_simple_auctions'), '1/10'=> __('1/10', 'wc_simple_auctions')); | |
} | |
add_filter('simple_auction_item_condition','wpse_242093_auctions'); | |
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); | |
function theme_enqueue_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
} | |
<?php | |
add_action( 'wp_ajax_posts_by_brand_action', 'posts_by_brand_action_callback' ); | |
function posts_by_brand_action_callback() { | |
global $wpdb; // this is how you get access to the database | |
$brand = $_POST['brand']; | |
echo $whatever; | |
// ----- START OF BRAND FILTER CODE | |
// args | |
$args = array( | |
//'numberposts' => -1, | |
//'post_type' => 'event', | |
'meta_key' => 'brand', | |
'meta_value' => $brand | |
); | |
// query | |
$the_query = new WP_Query( $args ); | |
if($the_query->have_posts() ): | |
?> | |
<ul> | |
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<li> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_title(); ?> | |
</a> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php | |
endif; | |
wp_reset_query(); // Restore global post data stomped by the_post(). | |
// ------ END OF BRAND FILTER CODE | |
wp_die(); // this is required to terminate immediately and return a proper response | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment