Skip to content

Instantly share code, notes, and snippets.

@slaffko1
slaffko1 / WP Customizer - Dropdown-pages
Created December 2, 2019 19:08 — forked from ajskelton/WP Customizer - Dropdown-pages
Add a Dropdown-pages field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_dropdownpages_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_dropdown_pages',
) );
$wp_customize->add_control( 'themeslug_dropdownpages_setting_id', array(
'type' => 'dropdown-pages',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Dropdown Pages' ),
'description' => __( 'This is a custom dropdown pages option.' ),
@slaffko1
slaffko1 / function.php
Created November 28, 2019 11:02
Woocommerce categories before products
function woocommerce_product_category( $args = array() ) {
$woocommerce_category_id = get_queried_object_id();
$args = array(
'parent' => $woocommerce_category_id
);
$terms = get_terms( 'product_cat', $args );
if ( $terms ) {
echo '<ul class="woocommerce-categories">';
foreach ( $terms as $term ) {
echo '<li class="woocommerce-product-category-page">';
.helper-mob {
display: none;
-ms-flex-direction: row;
flex-direction: row;
position: fixed;
left: 0;
bottom: 0;
right: 0;
width: 100%;
z-index: 10;
@slaffko1
slaffko1 / jquery-scroll-bottom.js
Created October 24, 2019 15:16 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
@slaffko1
slaffko1 / function.php
Created September 9, 2019 18:39
dequeue styles
add_action( 'wp_print_styles', 'dequeue_font_awesome_style' );
function dequeue_font_awesome_style() {
wp_dequeue_style( 'elementor-icons' );
wp_deregister_style( 'elementor-icons' );
wp_dequeue_style( 'font-awesome' );
wp_deregister_style( 'font-awesome' );
wp_dequeue_style( 'fontawsome' );
wp_deregister_style( 'fontawsome' );
@slaffko1
slaffko1 / gist:8e1e0f6314a9eedab1cdb99cfce68e22
Created September 3, 2019 12:32 — forked from Neolot/gist:3964380
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('котик', 'котика', 'котиков');
function declOfNum($number, $titles)
<fieldset>
<legend>You can edit messages used in various situations here. For details, see <a href="https://contactform7.com/editing-messages/">Editing Messages</a>.</legend>
<p class="description">
<label for="wpcf7-message-mail-sent-ok">Sender's message was sent successfully<br>
<input type="text" id="wpcf7-message-mail-sent-ok" name="wpcf7-messages[mail_sent_ok]" class="large-text" size="70" value="תודה לך על הודעתך, ההודעה נשלחה." data-config-field="messages.mail_sent_ok">
</label>
</p>
<p class="description">
<label for="wpcf7-message-mail-sent-ng">Sender's message failed to send<br>
<input type="text" id="wpcf7-message-mail-sent-ng" name="wpcf7-messages[mail_sent_ng]" class="large-text" size="70" value="בעת שליחת הודעתך אירע שגיאה, אנה נסה שנית מאוחר יותר." data-config-field="messages.mail_sent_ng">
@slaffko1
slaffko1 / ie67891011-css-hacks.txt
Last active July 17, 2019 18:05 — forked from vidaaudrey/ie67891011-css-hacks.txt
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
// getCookie(), setCookie(), deleteCookie()
// возвращает cookie если есть или undefined
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
const $menu = $('.dropdown');
$(document).mouseup(function (e) {
if (!$menu.is(e.target) // if the target of the click isn't the container...
&& $menu.has(e.target).length === 0) // ... nor a descendant of the container
{
$menu.removeClass('is-active');
}
});