<?php
if (!defined('WP_DEBUG')) {
die('Direct access forbidden.');
}
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
wp_enqueue_style('shopeo-absev', get_stylesheet_directory_uri() . '/css/style.css');
wp_enqueue_style('shopeo-child-style', get_stylesheet_uri());
});
//引用外部JS
function theme_name_scripts() {
wp_enqueue_script(
"jquery-min",
get_stylesheet_directory_uri().'/js/jquery.min.js',
array(),
"1.0.0",
false
);
wp_enqueue_script(
"swiper",
get_stylesheet_directory_uri().'/js/swiper.js?=4.5.3',
array(),
"1.0.0",
false
);
wp_enqueue_script(
"wow",
get_stylesheet_directory_uri().'/js/wow.js',
array(),
"1.0.0",
false
);
wp_enqueue_script(
"lazyload",
get_stylesheet_directory_uri().'/js/jquery.lazyload.js',
array(),
"1.0.0",
false
);
wp_enqueue_script(
"commones",
get_stylesheet_directory_uri().'/js/common.js',
array(),
"1.0.0",
false
);
wp_enqueue_script(
"avalon",
get_stylesheet_directory_uri().'/js/avalon.js',
array(),
"1.0.0",
false
);
}
add_action("wp_enqueue_scripts", "theme_name_scripts");
add_action("wp_ajax_vote_post_lists", "add_votes_list_options");
add_action("wp_ajax_nopriv_vote_post_lists", "add_votes_list_options");
//获取文章
function add_votes_list_options(){
if( isset($_POST['action']) && ($_POST['action'] == 'vote_post_lists') ){
$termid = (int)$_POST['postid'];
$dates = $_POST['dates'];
if($termid == 999999999){
$termid = '';
}
$arris = array(
'post_type' => 'post',
'category' => $termid,
'numberposts' => 9,
'offset' => $dates
);
$results = get_posts( $arris );
foreach ($results as $val){
$thumbnail_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($val->ID), 'thumbnail');
$val->thumbnail = $thumbnail_image_url[0];
$val->uurl = get_permalink($val->ID);
}
$queryww = json_encode($results);
echo $queryww;
die;
}
}