@font-face {
font-family: Inter;
font-display: swap;
src: url("/wp-content/themes/bs-base-vite/assets/fonts/Inter-Bold.woff2") format("woff2"),
url("/wp-content/themes/bs-base-vite/assets/fonts/Inter-Bold.woff") format("woff");
font-weight: 700;
font-style: normal;
}
$date_now = date('Y-m-d');
$volantino = new WP_Query([
'post_type' => 'cataloghi',
'posts_per_page' => -1,
'post_status' => array('publish'),
'meta_query' => array(
array(
'key' => 'data_fine_pubblicazione',
'value' => $date_now,
'type' => 'date',
'compare' => '>='
)
),
'tax_query' => [
[
'taxonomy' => 'categoria_volantino',
'field' => 'term_id',
'terms' => $term_id,
],
],
]);
add_action("init", "eg_create_sitemap");
$sitemap_path = ABSPATH . "sitemap.xml";
$pages_path = ABSPATH . "pages.xml";
$ads_path = ABSPATH . "ads-list.xml";
if (file_exists($sitemap_path)) {
unlink($sitemap_path);
}
if (file_exists($pages_path)) {
unlink($pages_path);
}
if (file_exists($ads_path)) {
unlink($ads_path);
}
function createUrlXml() {
$url_sitemap = '<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="' . get_template_directory_uri() . '/helpers/sitemap.css"?>';
$url_sitemap .= "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
$url_sitemap .= "\t" . '<url>' . "\n" . "\t\t" . '<loc>https://www.imprendocasa.it/ads-list.xml</loc>' . "\n\t\t" . '<lastmod>2021-09-30T01:10:02.000000Z</lastmod>' . "\n\t\t" . '<changefreq>monthly</changefreq>' . "\n\t" . '
</url>' . "\n";
$url_sitemap .= "\t" . '<url>' . "\n" . "\t\t" . '<loc>https://www.imprendocasa.it/pages.xml</loc>' . "\n\t\t" . '
<lastmod>2021-09-30T01:10:02.000000Z</lastmod>' . "\n\t\t" . '<changefreq>monthly</changefreq>' . "\n\t" . '
</url>' . "\n";
$url_sitemap .= '</urlset>';
return $url_sitemap;
}
function createPagesSitemap() {
$postsForSitemap = get_posts(array('numberposts' => -1, 'orderby' => 'modified', 'post_type' => array('post', 'page'), 'order' => 'DESC'));
$pages_sitemap = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/css" href="' . get_template_directory_uri() . '/helpers/sitemap.css"?>';
$pages_sitemap .= "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
foreach ($postsForSitemap as $post) {
setup_postdata($post);
$postdate = explode(" ", $post->post_modified);
$pages_sitemap .= "\t" . '<url>' . "\n" . "\t\t" . '<loc>' . get_permalink($post->ID) . '</loc>' . "\n\t\t" . '
<lastmod>' . $postdate[0] . '</lastmod>' . "\n\t\t" . '<changefreq>monthly</changefreq>' . "\n\t" . '</url>' . "\n";
}
$pages_sitemap .= '</urlset>';
return $pages_sitemap;
}
function createAdsSitemap() {
$adsForSitemap = getPropertiesId();
$adsForSitemap = json_decode($adsForSitemap)->data;
$ads_sitemap = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/css" href="' . get_template_directory_uri() . '/helpers/sitemap.css"?>';
$ads_sitemap .= "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
foreach ($adsForSitemap as $item) {
$ads_sitemap .= "\t" . '<url>' . "\n" . "\t\t" . '<loc>https://www.imprendocasa.it/ads?id=' . $item->id . '</loc>' . "\n\t\t" . '<lastmod>' . $item->updated_at . '</lastmod>' . "\n\t\t" . '<changefreq>monthly</changefreq>' . "\n\t" . '</url>' . "\n";
}
$ads_sitemap .= '</urlset>';
return $ads_sitemap;
}
function eg_create_sitemap() {
$url_sitemap = createUrlXml();
$pages_sitemap = createPagesSitemap();
$ads_sitemap = createAdsSitemap();
global $sitemap_path;
global $pages_path;
global $ads_path;
$fp = fopen($sitemap_path, 'w');
fwrite($fp, $url_sitemap);
fclose($fp);
$fp = fopen($pages_path, 'w');
fwrite($fp, $pages_sitemap);
fclose($fp);
$fp = fopen($ads_path, 'w');
fwrite($fp, $ads_sitemap);
fclose($fp);
}
public function checkIfTableExist()
{
global $wpdb;
$table_name = $wpdb->prefix . "google_analitycs_table";
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name) {
return true;
}
return false;
}
if ($googleAnalyticsPlugin->checkIfTableExist()) {
$googleAnalyticsPlugin->register();
}
'use strict';
let gulp = require('gulp'),
//css
// stylus = require('gulp-stylus'),
sass = require('gulp-sass'),
autoprefixer = require("gulp-autoprefixer"),
sourcemaps = require('gulp-sourcemaps'),
wait = require('gulp-wait'),
notify = require("gulp-notify"),
plumber = require("gulp-plumber"),
browserSync = require('browser-sync').create(),
replace = require('gulp-replace');
let siteUrl = 'http://wc-estore.host1670806.hostland.pro/';
let siteDir = '../wc-estore/';
gulp.task("scss", function () {
return gulp.src(siteDir + 'assets/scss/my.scss')
// .pipe(plumber())
.pipe(sourcemaps.init())
.pipe(wait(500))
.pipe(sass({
outputStyle: 'expanded'
}).on('error', notify.onError(function (error) {
return 'An error occurred while compiling sass.\nLook in the console for details.\n' + error;
})))
.pipe(autoprefixer({
cascade: false
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(siteDir + 'assets/css/'))
.pipe(browserSync.reload({stream: true}))
.pipe(notify("Change css"));
});
gulp.task("watch", function () {
gulp.watch(siteDir + 'assets/scss/**/*.scss', gulp.series('scss'));
});
gulp.task('browser-sync', function () {
browserSync.init({
proxy: {
target: siteUrl,
ws: true
},
reloadDelay: 2000
});
gulp.watch(siteDir + "**/*.php").on('change', browserSync.reload);
gulp.watch(siteDir + "**/*.css").on('change', browserSync.reload);
gulp.watch(siteDir + "**/*.js").on('change', browserSync.reload);
});
gulp.task('default', gulp.parallel('watch', 'browser-sync'));
jQuery.ajax({
type: 'POST',
url: search_form.url,
data: data,
dataType: 'html',
success: function (data) {
$('.search_form .search-result').html(data);
}
});
add_action( 'wp_ajax_myaction', 'esp_search_ajax_action_callback' );
add_action( 'wp_ajax_nopriv_myaction', 'esp_search_ajax_action_callback' );
function esp_search_ajax_action_callback() {
/**
* Проверяем нонсе из массива пости и из wp_localize script
*/
if(!wp_verify_nonce($_POST['nonce'], 'search-nonce')){
wp_die('Данные пришли с левого адреса');
}
$_POST = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
$args = [
'post_type' => ['post', 'product'],
'post_status' => 'public',
's' => $_POST['s'],
];
$query_ajax = new WP_Query($args);
?>
<?php if($query_ajax->have_posts()): ?>
<?php while($query_ajax->have_posts()): ?>
<?php $query_ajax->the_post(); ?>
<h3 class="title-search"><?php the_title(); ?></h3>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<?php
wp_die();
}
// Сохранение настроек виджета (очистка)
function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( !empty( $new_instance['title'] ) ) ? ( $new_instance['title'] ) : '';
$instance['count'] = ( !empty( $new_instance['count'] ) ) ? strip_tags( $new_instance['count'] ) : '5';
return $instance;
}