Skip to content

Instantly share code, notes, and snippets.

View RiodeJaneiroo's full-sized avatar
🎯
Focusing

Vadim Zmiievskyi RiodeJaneiroo

🎯
Focusing
  • Ukraine
View GitHub Profile
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active October 23, 2018 10:46
[Lang site] #wordpress #polylang
define('SITE_LANG', pll_current_language('slug'));
if (function_exists('pll_register_string')) {
pll_register_string('Chat with us', 'Discute avec nous', 'Theme');
}
// for custom post type add lang
add_filter( 'pll_get_post_types', 'add_cpt_to_pll', 10, 2 );
function add_cpt_to_pll( $post_types, $is_settings ) {
@RiodeJaneiroo
RiodeJaneiroo / .htaccess
Created November 7, 2018 21:57
[Wordpress redirect www to non www] 301 Redirect from www to non www with https
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^.*$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created November 12, 2018 15:53
[Woocommerce] Изменение формата цены, вместо диапазона вывести "От:" #woocommerce #wordpress
**
* Изменить формат цены - вместо диапазона вывести "От: "
*
* @param float $price Цена товара.
* @param object $product Товар.
* @return string
*/
function variable_price_format_filter( $price, $product ) {
$prefix = 'От: ';
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created November 14, 2018 10:58
[Wordpress antispam fucntion] #wordpress #antispam
<?php echo antispambot();?>
@RiodeJaneiroo
RiodeJaneiroo / sql.sql
Created November 14, 2018 16:18
[Wordpress Opimize] optimize wp #wordpress #optimize
DELETE FROM wp_posts WHERE post_type = "revision";
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active November 15, 2018 19:10
[Wordpress CPT - reviews ] Register custom post type - Reviews #wordpress #cpt
add_action('init', 'mp_register_reviews');
function mp_register_reviews(){
register_post_type('reviews', array(
'labels' => array(
'name' => 'Отзывы', // Основное название типа записи
'singular_name' => 'Отзыв', // отдельное название записи типа Book
'add_new' => 'Добавить новый отзыв',
'add_new_item' => 'Добавить новый отзыв',
'edit_item' => 'Редактировать отзыв',
'new_item' => 'Новый отзыв',
@RiodeJaneiroo
RiodeJaneiroo / style.css
Created November 15, 2018 19:33
[CSS border - dashed styling] #css #border
.expl {
background-image: url("data:image/svg+xml;utf8,<svg width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill: none; stroke: #d9d3cb; stroke-width: 4; stroke-dasharray: 8 8'/></svg>");
}
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active March 27, 2019 13:34
[Wordpress ajax load post on click button] Ajax load posts click button #wordpress #ajax
/**
* Javascript for Load More
*
*/
function be_load_more_js() {
$query = array(
'posts_per_page' => 6,
'post_type' => 'reviews'
@RiodeJaneiroo
RiodeJaneiroo / index.js
Last active December 1, 2018 12:44
[Склонение числительных javascript] #js #javascript
//Склонение числительных
function declOfNum(n, titles) {
return titles[(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)];
}
/*
use: declOfNum(count, ['найдена', 'найдено', 'найдены']);
*/
@RiodeJaneiroo
RiodeJaneiroo / index.html
Last active December 17, 2018 14:30
[Hambureger menu] #css #mobileMenu
<div class="menu-wrapper">
<div class="hamburger-menu"></div>
</div>