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;
//Atom Settings
@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 / gulpfile.js
Last active May 6, 2023 10:46
Install wordpress + theme with gulp.js
// npm install [email protected] gulp-decompress gulp-download vinyl-ftp del gulp-open gulp-run
/****************************
FTP Server connection
****************************/
var ftp_host = 'devurl.net',
ftp_user = 'user',
ftp_pass = 'pass',
//theme_name = 'gulp-starter',
theme_path = './wp-content/themes/';
@vol4ikman
vol4ikman / update-subfields-acf.php
Created April 3, 2017 08:32
Update subfields ACF
<?php
$fields = array();
// $dates = array of subfields to update
// $post_id = where to update fields
$repeater_key = 'field_58e1e3a5fe92f';
foreach( $dates as $tour_date ) {
@vol4ikman
vol4ikman / wahpro.html
Last active October 6, 2017 21:29
WAH PRO - remote script alpha
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
var wahproConfig = {
user : {
id: 123123, // user ID
token : 'qwerty' // user secret token
},
theme: {
name : 'dark', // dark || light
position : 'right', // right || left
@vol4ikman
vol4ikman / index.php
Created November 27, 2018 06:04
Fix wah options
update_option('wah_sidebar_widgets_order','');
@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'] ) ) {