You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

74 lines
2.4 KiB

<?php
/*
* Plugin Name: Functions by Good Production
* Description: Плагин с подключением функционала от Good Production.
* Version: 1.0
* Author: Good Production
* Author URI: https://good-production.ru/
*/
/* Подключили скрипты плагина */
// function gp_popup_plugin_scripts(){
// if ( !is_admin() ) {
// wp_enqueue_script( 'gp-popup-scripts', plugin_dir_url( __FILE__ ) . '/assets/gp-dev-scripts.js', array(), null , true );
// wp_enqueue_style( 'gp-popup-styles', plugin_dir_url( __FILE__ ) . '/assets/gp-dev-styles.css');
// }
// }
// add_action('wp_enqueue_scripts', 'gp_popup_plugin_scripts');
/* ПРИМЕР: Описание функционала */
// add_filter('woocommerce_default_catalog_orderby', 'gp_default_catalog_orderby', 50);
// function gp_default_catalog_orderby( $t ){
// return 'price';
// }
/* GP | Проверка на production и development версию сайта */
global $main_host;
$main_host = 'cosmopet.shop'; // ЗАМЕНИТЬ!
global $site_work_mode;
if($_SERVER['SERVER_NAME'] == $main_host){
$site_work_mode = 'production';
}else{
$site_work_mode = 'develope';
}
function add_inline_style_to_footer() {
if(is_product_category()){
?>
<style>
/* GP | Поправили кривые красткие описания в мини-карточках товаров в категориях */
.wd-hover-with-fade .fade-in-block {
position: relative;
visibility: visible;
opacity: 1;
}
</style>
<?
}
}
add_action( 'wp_footer', 'add_inline_style_to_footer', 100 );
/* GP | Закрыли от индексации товары "Soon" */
$cur_page = str_replace('/projects-in-work/cosmopet', '', $_SERVER['REQUEST_URI']);
$soon_pages = [
"/product/cosmocat-yagnyonok-sterilized-adult-18kg/",
"/product/cosmocat-ryba-regular-18kg/",
"/product/cosmocat-ryba-sterilized-adult-18kg/",
"/product/cosmocat-yagnyonok-regular-18kg/",
"/product/cosmocat-indejka-sterilized-adult-18kg/",
"/product/cosmocat-indejka-regular-18kg/",
];
if(in_array($cur_page, $soon_pages)){
add_filter( 'wp_robots', 'gp_noindex' );
function gp_noindex( $robots ){
$robots['noindex'] = true;
return $robots;
}
}