Skip to content

Instantly share code, notes, and snippets.

View vol4ikman's full-sized avatar

Alex Volkov vol4ikman

View GitHub Profile
// add this to your theme's functions.php
/*
* Define a custom option type
* this type will repeat some text inputs
*/
function repeat_text_option_type( $option_name, $option, $values ){
$counter = 0;
@vol4ikman
vol4ikman / wp-query-ref.php
Created March 29, 2016 11:53 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@vol4ikman
vol4ikman / woocommerce - minimum and maximum price
Created August 31, 2022 13:01 — forked from Daniel217D/woocommerce - minimum and maximum price
woocommerce - get minimum and maximum price for current products
function get_filtered_price() {
global $wpdb;
$args = wc()->query->get_main_query();
$tax_query = isset( $args->tax_query->queries ) ? $args->tax_query->queries : array();
$meta_query = isset( $args->query_vars['meta_query'] ) ? $args->query_vars['meta_query'] : array();
foreach ( $meta_query + $tax_query as $key => $query ) {
if ( ! empty( $query['price_filter'] ) || ! empty( $query['rating_filter'] ) ) {