Skip to content

Instantly share code, notes, and snippets.

View yuriitaran's full-sized avatar

Yurii Taran yuriitaran

View GitHub Profile
// functions.php
function filter_plugin_updates( $value ) {
if( isset( $value->response['woocommerce/woocommerce.php'] ) ){
unset( $value->response['woocommerce/woocommerce.php'] );
}
return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
// prevent to scroll dovh on reCAPTCHA click on iOS devices
window.scrollCaptcha = false;
var cat_id = document.querySelector('.ginput_recaptcha').id;
document.getElementById(cat_id).setAttribute('data-callback','scrollFixCaptcha');
function scrollFixCaptcha(a) { if(window.scrollCaptcha) { jQuery("html, body").scrollTop(window.scrollCaptcha); } }
document.addEventListener("scroll", function() {
var el = document.getElementById(cat_id);
var theTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
<?php comments_number( __('No Comments', 'textdomain'), __('One Comment', 'textdomain'), __('(%) Comments', 'textdomain') ); ?>
<?php $field_name = ( get_field('field_name', 'category_'. $cat) ) ? get_field('field_name', 'category_'. $cat) : false ; ?>
// post (post-type) out of the loop
<?php $field_name = ( get_field('field_name', the_ID()) ) ? get_field('field_name', the_ID()) : false ; ?>
// post (post-type) in the loop
<?php $field_name = ( get_field('field_name') ) ? get_field('field_name') : false ; ?>
// category
<?php $field_name = ( get_field('field_name', $cat) ) ? get_field('field_name', 'category_' . $cat) : false ; ?>
// taxonomy ????????????
// the 1-st way
wp_deregister_style( 'style-handle' );
// the 2-nd way
add_filter('style-handle', '__return_false');
// the 3-rd way
function custom_dequeue() {
wp_dequeue_style('style-handle');
wp_deregister_style('style-handle');
// in footer.php or header.php
<div><strong>Current template:</strong> <?php get_current_template( true ); ?></div>
// in functions.php
/**
* Define current template file
*
* Create a global variable with the name of the current
* theme template file being used.
*
@yuriitaran
yuriitaran / WP Gravity forms - label visibility settings
Last active January 7, 2018 07:57
WP Gravity Form field label visibility option
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
@yuriitaran
yuriitaran / WP Crib (WP шпаргалка)
Last active January 7, 2018 07:58
WP Crib (WP шпаргалка)
// path to theme
<?php echo get_template_directory_uri(); ?>
// path to 'content' directory
<?php echo content_url(); ?>
<nav class="top-bar" id="main-menu">
<?php
if (has_nav_menu('header-menu')) {
wp_nav_menu(array('theme_location' => 'header-menu',
'menu_class' => 'menu header-menu dropdown',
'items_wrap' => '<ul id="%1$s" class="%2$s" data-responsive-menu="accordion medium-dropdown" data-disable-hover="true" data-click-open="true" data-close-on-click-inside="false">%3$s</ul>',
'walker' => new Foundation_Navigation()));
}
?>
</nav>