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
function show_template() { | |
if( is_super_admin() ){ | |
global $template; | |
print_r($template); | |
} | |
} | |
add_action('wp_footer', 'show_template'); |
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
// Hook in | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
// Our hooked in function - $fields is passed via the filter! | |
function custom_override_checkout_fields( $fields ) { | |
$fields['order']['order_comments']['placeholder'] = 'My new placeholder'; | |
return $fields; | |
} | |
Billing |
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 | |
$currentlang = get_bloginfo('language'); | |
if($currentlang=="ru-RU"): | |
?> | |
ru | |
<?php else: ?> | |
eng | |
<?php endif; ?> |
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
function new_excerpt_length($length) { | |
return 10; | |
} | |
add_filter('excerpt_length', 'new_excerpt_length'); | |
<?php the_excerpt('new_excerpt_length', 10); ?> | |
function trim_characters($count, $after = '...'){ | |
$excerpt = get_the_content(); | |
$excerpt = strip_tags($excerpt); |
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 | |
echo '<div style="text-align: center">WordPress: ' | |
. round(memory_get_usage()/1024/1024, 2) . 'MB ' | |
.' | MySQL:' . get_num_queries() . ' | '; | |
timer_stop(1); | |
echo 'sec</div>'; | |
?> |
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
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
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
RewriteEngine on | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} !(.html) | |
RewriteCond %{REQUEST_URI} !(.jpg) | |
RewriteCond %{REQUEST_URI} !(.*)/$ | |
RewriteRule ^(.*)$ https://your-site.com/$1/ [L,R=301] |
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
/** | |
* Отключаем принудительную проверку новых версий WP, плагинов и темы в админке, | |
* чтобы она не тормозила, когда долго не заходил и зашел... | |
* Все проверки будут происходить незаметно через крон или при заходе на страницу: "Консоль > Обновления". | |
* | |
* @see https://wp-kama.ru/filecode/wp-includes/update.php | |
* @author Kama (https://wp-kama.ru) | |
* @version 1.0 | |
*/ | |
if( is_admin() ){ |
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 | |
$order = "&orderby=date&order=DESC"; | |
$s2 = ' selected="selected"'; | |
if ($_POST['select'] == 'title') { $order = "&orderby=title&order=ASC"; $s1 = ' selected="selected"'; $s2 = ''; } | |
if ($_POST['select'] == 'newest') { $order = "&orderby=date&order=DESC"; $s2 = ' selected="selected"'; } | |
if ($_POST['select'] == 'oldest') { $order = "&orderby=date&order=ASC"; $s3 = ' selected="selected"'; $s2 = ''; } | |
if ($_POST['select'] == '2016') { $order = "&year=2016"; $s4 = ' selected="selected"'; $s2 = ''; } | |
if ($_POST['select'] == '4') { $order = "&posts_per_page=4"; $s4 = ' selected="selected"'; $s2 = ''; } | |
if ($_POST['select'] == '6') { $order = "&posts_per_page=6"; $s5 = ' selected="selected"'; $s2 = ''; } |
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
/*display current post -> startdate<=today...enddate>=today */ | |
<?php | |
$today = date('Ymd'); | |
$date_args = array ( | |
'post_type' => 'post', | |
'category_name' => '....',/*name category posts*/ | |
'meta_key' => 'start_ico', | |
'posts_per_page' => -1, | |
'orderby' => 'meta_value_num', | |
'order' => 'ASC', |
OlderNewer