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
Created November 14, 2018 10:58
[Wordpress antispam fucntion] #wordpress #antispam
<?php echo antispambot();?>
@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 / .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
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 / index.html
Last active October 17, 2018 15:22
[flip logo] #css #html #animation
<div class="logos">
<div class="front"><img src="img/spec-rus.svg" alt="УКС «Спецпартнер»" class="logo"></div>
<div class="back"><img src="img/spec-eng.svg" alt="UKS «Specpartner»" class="logo"></div>
</div>
@RiodeJaneiroo
RiodeJaneiroo / index.php
Created October 12, 2018 15:39
[Basic loop – wordpress] wordpress basic loop #wordpress #loop
<?php while ( have_posts() ) : the_post(); ?>
<?php endwhile;?>
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active October 12, 2018 09:28
[Ajax url in head] Wordpress past url ajax #ajaxurl #wordpress
// custom change on your own scripts
wp_localize_script( 'custom', 'myajax',
array(
'url' => admin_url('admin-ajax.php')
)
);
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Last active October 12, 2018 09:11
[AJAX Request – Wordpress] Ajax request wordpress #ajax #wordpress
add_action( 'wp_ajax_misha', 'test_function' ); // wp_ajax_{ЗНАЧЕНИЕ ПАРАМЕТРА ACTION!!}
add_action( 'wp_ajax_nopriv_misha', 'test_function' ); // wp_ajax_nopriv_{ЗНАЧЕНИЕ ACTION!!}
// первый хук для авторизованных, второй для не авторизованных пользователей
function test_function(){
$summa = $_POST['param1'] + $_POST['param2'];
echo $summa;
die; // даём понять, что обработчик закончил выполнение
@RiodeJaneiroo
RiodeJaneiroo / robots.txt
Created October 11, 2018 20:25
[robots.txt – Close site] Close the whole site from indexing
User-agent: *
Disallow: /
@RiodeJaneiroo
RiodeJaneiroo / functions.php
Created October 10, 2018 12:02
[Disable canonical URLs - YOASY] To disable the canonical entirely, you could do the following: #wordpress #yoast #canonical
add_filter( 'wpseo_canonical', '__return_false' );