<?php
/** 后端接口代码
* Plugin Name: Elementor List Widget
* Description: List widget for Elementor.
* Plugin URI: https://elementor.com/
* Version: 1.0.0
* Author: Elementor Developer
* Author URI: https://developers.elementor.com/
* Text Domain: elementor-list-widget
*
* Elementor tested up to: 3.7.0
* Elementor Pro tested up to: 3.7.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Register List Widget.
*
* Include widget file and register widget class.
*
* @since 1.0.0
* @param \Elementor\Widgets_Manager $widgets_manager Elementor widgets manager.
* @return void
*/
function register_list_widget( $widgets_manager ) {
require_once( __DIR__ . '/widgets/list-widget.php' );
require_once( __DIR__ . '/widgets/list-widget1.php' );
require_once( __DIR__ . '/widgets/list-widget2.php' );
require_once( __DIR__ . '/widgets/list-widget3.php' );
require_once( __DIR__ . '/widgets/list-widget4.php' );
require_once( __DIR__ . '/widgets/list-widget5.php' );
require_once( __DIR__ . '/widgets/list-widget6.php' );
require_once( __DIR__ . '/widgets/list-widget7.php' );
require_once( __DIR__ . '/widgets/pro-widget.php' );
require_once( __DIR__ . '/widgets/pro-widget1.php' );
require_once( __DIR__ . '/widgets/pro-widget2.php' );
require_once( __DIR__ . '/widgets/pro-widget3.php' );
require_once( __DIR__ . '/widgets/pro-widget4.php' );
require_once( __DIR__ . '/widgets/pro-widget5.php' );
require_once( __DIR__ . '/widgets/pro-widget6.php' );
require_once( __DIR__ . '/widgets/pro-widget7.php' );
require_once( __DIR__ . '/widgets/pro-widget8.php' );
require_once( __DIR__ . '/widgets/pro-widget9.php' );
require_once( __DIR__ . '/widgets/pro-widget10.php' );
require_once( __DIR__ . '/widgets/pro-widget11.php' );
require_once( __DIR__ . '/widgets/pro-widget12.php' );
require_once( __DIR__ . '/widgets/pro-widget13.php' );
require_once( __DIR__ . '/widgets/pro-widget14.php' );
require_once( __DIR__ . '/widgets/pro-widget15.php' );
require_once( __DIR__ . '/widgets/pro-widget16.php' );
require_once( __DIR__ . '/widgets/pro-widget17.php' );
$widgets_manager->register( new \Elementor_List_Widget() );
$widgets_manager->register( new \Elementor_List_Widget1() );
$widgets_manager->register( new \Elementor_List_Widget2() );
$widgets_manager->register( new \Elementor_List_Widget3() );
$widgets_manager->register( new \Elementor_List_Widget4() );
$widgets_manager->register( new \Elementor_List_Widget5() );
$widgets_manager->register( new \Elementor_List_Widget6() );
$widgets_manager->register( new \Elementor_List_Widget7() );
$widgets_manager->register( new \Elementor_Pro_Widget() );
$widgets_manager->register( new \Elementor_Pro_Widget1() );
$widgets_manager->register( new \Elementor_Pro_Widget2() );
$widgets_manager->register( new \Elementor_Pro_Widget3() );
$widgets_manager->register( new \Elementor_Pro_Widget4() );
$widgets_manager->register( new \Elementor_Pro_Widget5() );
$widgets_manager->register( new \Elementor_Pro_Widget6() );
$widgets_manager->register( new \Elementor_Pro_Widget7() );
$widgets_manager->register( new \Elementor_Pro_Widget8() );
$widgets_manager->register( new \Elementor_Pro_Widget9() );
$widgets_manager->register( new \Elementor_Pro_Widget10() );
$widgets_manager->register( new \Elementor_Pro_Widget11() );
$widgets_manager->register( new \Elementor_Pro_Widget12() );
$widgets_manager->register( new \Elementor_Pro_Widget13() );
$widgets_manager->register( new \Elementor_Pro_Widget14() );
$widgets_manager->register( new \Elementor_Pro_Widget15() );
$widgets_manager->register( new \Elementor_Pro_Widget16() );
$widgets_manager->register( new \Elementor_Pro_Widget17() );
}
add_action( 'elementor/widgets/register', 'register_list_widget' );
function register_widget_scripts() {
wp_register_script( 'jquery', plugins_url( 'assets/owlcarousel/jquery.min.js', __FILE__ ),array(),'1.1', false );
wp_register_script( 'owlcarousel', plugins_url( 'assets/owlcarousel/owl.carousel.js', __FILE__ ),array(),'1.1', false );
wp_register_script( 'widget-script-1', plugins_url( 'assets/js/widget-script-1.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-2', plugins_url( 'assets/js/widget-script-2.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'external-library', plugins_url( 'assets/js/libs/external-library.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-3', plugins_url( 'assets/js/widget-script-3.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-4', plugins_url( 'assets/js/widget-script-4.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-5', plugins_url( 'assets/js/widget-script-5.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-6', plugins_url( 'assets/js/widget-script-6.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-7', plugins_url( 'assets/js/widget-script-7.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-8', plugins_url( 'assets/js/widget-script-8.js', __FILE__ ) ,array(),'1.1', false);
wp_register_script( 'widget-script-9', plugins_url( 'assets/js/swiper.min.js', __FILE__ ) ,array(),'1.1', false);
wp_enqueue_script( 'script-jquery', plugins_url( 'assets/js/code.js', __FILE__ ), array('jquery'), '1.0.0', false );
wp_enqueue_script( 'script-jquery', plugins_url( 'assets/js/avalon.js', __FILE__ ), array('jquery'), '1.0.0', false );
}
add_action( 'wp_enqueue_scripts', 'register_widget_scripts' );
function register_widget_styles() {
wp_enqueue_style('parent-style-qiantai', plugins_url( 'assets/css/style.css', __FILE__ ));
wp_enqueue_style('range', plugins_url( 'assets/css/range.css', __FILE__ ));
wp_register_style( 'widget-style-1', plugins_url( 'assets/css/widget-style-1.css', __FILE__ ) );
wp_register_style( 'widget-style-2', plugins_url( 'assets/css/widget-style-2.css', __FILE__ ), [ 'external-framework' ] );
wp_register_style( 'external-framework', plugins_url( 'assets/css/libs/external-framework.css', __FILE__ ) );
wp_register_style( 'widget-style-3', plugins_url( 'assets/css/widget-style-3.css', __FILE__ ) );
wp_register_style( 'widget-style-4', plugins_url( 'assets/css/widget-style-4.css', __FILE__ ) );
wp_register_style( 'widget-style-5', plugins_url( 'assets/css/widget-style-5.css', __FILE__ ) );
wp_register_style( 'widget-style-6', plugins_url( 'assets/css/widget-style-6.css', __FILE__ ) );
wp_register_style( 'widget-style-7', plugins_url( 'assets/css/widget-style-7.css', __FILE__ ) );
wp_register_style( 'widget-style-8', plugins_url( 'assets/css/widget-style-8.css', __FILE__ ) );
wp_register_style( 'widget-style-9', plugins_url( 'assets/css/widget-style-9.css', __FILE__ ) );
wp_register_style( 'widget-style-13', plugins_url( 'assets/css/swiper.min.css', __FILE__ ) );
wp_register_style( 'widget-style-14', plugins_url( 'assets/css/swiper-bumdle.min.css', __FILE__ ) );
wp_register_style( 'widget-style-11', plugins_url( 'assets/owlcarousel/assets/owl.carousel.css', __FILE__ ) );
wp_register_style( 'widget-style-10', plugins_url( 'assets/owlcarousel/assets/owl.theme.default.css', __FILE__ ) );
wp_register_style( 'widget-style-12', plugins_url( 'assets/css/swiper.min.css', __FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'register_widget_styles' );
function add_elementor_widget_categories( $elements_manager ) {
$elements_manager->add_category(
'Case',
[
'title' => esc_html__( 'Case', 'textdomain' ),
'icon' => 'fa fa-plug',
]
);
$elements_manager->add_category(
'Productdetail',
[
'title' => esc_html__( 'Productdetail', 'textdomain' ),
'icon' => 'fa fa-plug',
]
);
$elements_manager->add_category(
'Market',
[
'title' => esc_html__( 'Market', 'textdomain' ),
'icon' => 'fa fa-plug',
]
);
}
add_action( 'elementor/elements/categories_registered', 'add_elementor_widget_categories' );
/**头部搜索简码开始*/
function hdcodes_f(){
?>
<div class="imgcode cks">
<?php
echo '<img src="'.plugins_url( 'assets/image/icon_search.png', __FILE__ ).'" alt="">';
?>
</div>
<div class="imgcode_box">
<div class="box_img">
<div class="xx"><span class="searches">Search</span><span class="cks">x</span></div>
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<div class="xxcont">
<input type="text" style="flex:1;border-radius:0;" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="Search...">
<button type="submit" id="searchsubmit">
<?php
echo '<img src="'.plugins_url( 'assets/image/icon_search.png', __FILE__ ).'" alt="">';
?>
</button>
</div>
</form>
</div>
</div>
<?php
}
add_shortcode('hdcodes','hdcodes_f');
/**头部搜索简码结束*/
/**产品筛选简码开始*/
add_shortcode('productFilter','productFilter_f');
function productFilter_f()
{
?>
<script src="/wp-content/plugins/elementor-list-widget/assets/owlcarousel/jquery.min.js"></script>
<script src="/wp-content/plugins/elementor-list-widget/assets/js/ion.rangeSlider.min.js"></script>
<script src="/wp-content/plugins/elementor-list-widget/assets/js/avalon.js"></script>
<script type="text/javascript">var ajax_url = '<?php echo admin_url(); ?>admin-ajax.php';</script>
<div class="page-products" ms-controller="product_list">
<div class="inner">
<div class="subnav fnt18 wow fadeInUp50" style="visibility: visible; animation-name: fadeInUp50;">
<div class="w1440">
<ul>
<?php
$categories = get_terms( ['taxonomy' => 'product_cat', 'hide_empty' => false] );
foreach ($categories as $value) {
?>
<li ms-click="changeCategory(<?php echo $value->term_id;?>)" data-id="<?php echo $value->term_id;?>" data-name="<?php echo $value->name;?>"><a href="javascript:;"><?php echo $value->name;?></a></li>
<?php
}
?>
</ul>
</div>
</div>
<div class="sub-range wow fadeInUp50" style="visibility: visible; animation-name: fadeInUp50;">
<div class="w1440 in">
<div class="name fnt16">Viewing Distance</div>
<div class="select-range ">
<input type="text" class="js-range-slider irs-hidden-input" name="my_range" value="" data-type="double" data-min="0" data-max="16" data-from="2.5" data-to="8" data-grid="true" tabindex="-1" readonly="">
</div>
</div>
</div>
<div class="content wow fadeInUp50" style="visibility: visible; animation-name: fadeInUp50;">
<div class="w1440">
<ul>
<li class="wow fadeInUp50" style="visibility: visible; animation-name: fadeInUp50;" ms-repeat-el="lists">
<div class="box">
<a ms-attr-href="{{el.links}}" target="_blank">
<div class="img"><img ms-attr-src="{{el.thumbnail}}" class="lazy" alt="">
<span class="new"></span>
</div>
<div class="txt">
<h3 class="fnt24">{{el.post_title}}</h3>
<h5>{{el.post_excerpt}}</h5>
<p class="fnt16">Available Pixel Pitches: {{el.cs}}</p>
</div>
</a>
</div>
</li>
</ul>
<div class="btn-more wow fadeInUp50" style="visibility: visible; animation-name: fadeInUp50;">
<a href="javascript:;" ms-click="getMore">Veiw more</a>
</div>
</div>
</div>
</div>
</div>
<script>
var vm = avalon.define({
$id:"product_list",
cid:<?php echo $categories[0]->term_id;?>,
fm:'2.5',
sm:'8',
lists:[],
rangeVal:'',
offset:0,
catename:'<?php echo single_cat_title();?>',
rangechange:function(a){
$(".js-range-slider").ionRangeSlider({
postfix: "m",
step: 0.5,
});
$('.js-range-slider').on('change', function() {
vm.offset = 0;
vm.lists = [];
var datas = $(this).val();
vm.fm = datas.split(";")[0];
vm.sm = datas.split(";")[1];
vm.getProductList();
});
},
changeCategory:function(obj){
vm.offset = 0;
vm.lists = [];
vm.cid = obj;
vm.getProductList();
$(this).attr("disabled",true).siblings().attr("disabled",false);
$(this).css("pointer-events","none").siblings().css("pointer-events",'all');
},
getProductList:function(){
$.ajax({
url:ajax_url,
type:'post',
data:'action=vote_prodct_lists&cid=' + vm.cid + '&fm=' + vm.fm + '&sm=' + vm.sm + '&offset=' + vm.offset,
success:function(result){
var lenRe = JSON.parse(result);
if(lenRe.length == 0){
return
}
vm.lists = vm.lists.concat(JSON.parse(result));
console.log(vm.lists);
}
})
},
getMore:function(){
vm.offset+=6;
vm.getProductList();
},
pageCurid:function(){
if(vm.catename && vm.catename.length>0){
$.each($(".subnav ul li"),function(){
console.log($(this).data("name"));
if($(this).data("name") == vm.catename){
vm.cid = $(this).data("id");
$(this).addClass('active').siblings().removeClass('active');
}
})
}else{
$(".page-products ul li").eq(0).addClass('active');
vm.cid = <?php echo $categories[0]->term_id;?>;
}
vm.getProductList();
}
})
vm.rangechange();
vm.pageCurid();
</script>
<?php
}
/**产品筛选简码结束*/
/**Case筛选简码开始*/
add_shortcode('CaseFilter','caseFilter_f');
function caseFilter_f()
{
?>
<script src="/wp-content/plugins/elementor-list-widget/assets/owlcarousel/jquery.min.js"></script>
<script src="/wp-content/plugins/elementor-list-widget/assets/js/avalon.js"></script>
<script type="text/javascript">var ajax_url = '<?php echo admin_url(); ?>admin-ajax.php';</script>
<div class="page-case" ms-controller="case_list">
<!--case正文-->
<div class="caseLists">
<div class="w1440">
<div class="subnav fnt20 wow fadeInUp5 animated" style="visibility: visible;">
<ul style="padding-left:0; margin-left:0;">
<!--/cases/-->
<li class="active" ms-click="changeCategory('')"><a href="javascript:;">ALL</a></li>
<?php
$categories = get_terms( ['taxonomy' => 'case-category', 'hide_empty' => false] );
$cateArr = array();
foreach ($categories as $value) {
if($value->parent == 0){
array_push($cateArr,$value);
}
}
foreach ($cateArr as $valuees) {
?>
<li ms-click="changeCategory(<?php echo $valuees->term_id;?>)"><a href="javascript:;"><?php echo $valuees->name;?></a></li>
<?php
}
?>
</ul>
</div>
<div class="content">
<div class="item" style="display: block;">
<div class="sort fnt20">
<a ms-repeat-el="lists" ms-click="get_arcticlas(el.term_id)">{{el.name}}</a>
</div>
<ul>
<!--<li ms-repeat-el="artList">-->
<!-- <a ms-attr-href="el.links">-->
<!-- <div class="img"><img ms-attr-src="el.imgurl" class="lazy" alt=""></div>-->
<!-- <div class="txt">-->
<!-- <h2 class="fnt22">{{el.post_title}}</h2>-->
<!-- <p class="fnt16">{{el.post_excerpt}}-->
<!-- </p>-->
<!-- <button>View more</button>-->
<!-- </div>-->
<!-- </a>-->
<!--</li>-->
</ul>
<div class="btn-more"><a href="javascript:;" ms-click="getMore">Veiw more</a></div>
</div>
</div>
</div>
</div>
<!--case正文-->
</div>
<script>
$(".caseLists .subnav ul li").click(function(){
$(this).addClass('active').siblings().removeClass('active');
})
$(".caseLists .content .sort a").click(function(){
$(this).addClass('active').siblings().removeClass('active');
})
var vmm = avalon.define({
$id:"case_list",
cid:'',//一级分类
sid:'',//二级分类
lists:[],
offset:0,
artList:[],
changeCategory:function(termid){
vmm.lists=[];
vmm.artList = [];
$(".caseLists .content ul").children().remove();
$(this).attr("disabled",true).siblings().attr("disabled",false);
$(this).css("pointer-events","none").siblings().css("pointer-events",'all');
vmm.offset = 0;
vmm.sid = termid;
$.ajax({
url:ajax_url,
type:'post',
data:'action=vote_case_lists&cid=' + termid,
success:function(result){
vmm.lists = result;
vmm.get_arcticlas_by_id();
}
})
},
get_arcticlas:function(termid){
$(this).attr("disabled",true).siblings().attr("disabled",false);
$(this).css("pointer-events","none").siblings().css("pointer-events",'all');
vmm.sid = termid;
vmm.artList = [];
$(".caseLists .content ul").children().remove();
vmm.offset = 0;
vmm.get_arcticlas_by_id();
$(this).addClass('active').siblings().removeClass('active');
},
get_arcticlas_by_id:function(){
$.ajax({
url:ajax_url,
type:'post',
data:'action=get_case_lists&sid=' + vmm.sid + '&offset=' + vmm.offset,
success:function(result){
var lenRe = result.length;
if(lenRe == 0){
return
}
// vmm.artList = vmm.artList.concat(result);
var str = "";//定义变量保存内容
$.each(result,function(index,array){
if (array['ID']){
str += '<li>'+
'<a href="'+array['links']+'">'+
'<div class="img"><img src="'+array['imgurl']+'"/></div>'+
'<div class="txt">'+
'<h2 class="fnt22">'+array['post_title']+'</h2>'
+'<p class="fnt16">' + array['post_excerpt'] + '</p>' +
'<button>View more</button>' +
'</div>'+
'</a>'+
'</li>';
}else{
$("#caseLists .content ul").html("没有更多内容了..");
}
});
$(".caseLists .content ul").append(str).fadeIn('slow');
}
})
},
getMore:function(){
vmm.offset+=6;
vmm.get_arcticlas_by_id();
}
})
vmm.get_arcticlas_by_id();
</script>
<?php
}
/**Case筛选简码结束*/
/**Carass筛选简码开始*/
add_shortcode('carassFilter','carassFilter_f');
function carassFilter_f()
{
ob_start();
?>
<script src="/wp-content/plugins/elementor-list-widget/assets/owlcarousel/jquery.min.js"></script>
<script src="/wp-content/plugins/elementor-list-widget/assets/js/avalon.js"></script>
<script type="text/javascript">var ajax_url = '<?php echo admin_url(); ?>admin-ajax.php';</script>
<div class="page-careers-Join" ms-controller="content_list">
<div class="content">
<!-- conditional filtering -->
<div class="filters fnt16">
<form action="">
<div class="item">
<span class="name">Religion</span>
<div class="select-item">
<span></span>
<ul>
<li ms-click="religionFun('')">请选择</li>
<li ms-repeat-el="artList.religion" ms-click="religionFun(el.term_id)">{{el.name}}</li>
</ul>
</div>
</div>
<div class="item">
<span class="name">Country</span>
<div class="select-item">
<span></span>
<ul>
<li ms-click="countryFun('')">请选择</li>
<li ms-repeat-el="artList.country" ms-click="countryFun(el.term_id)">{{el.name}}</li>
</ul>
</div>
</div>
<div class="item">
<span class="name">Job Type</span>
<div class="select-item">
<span></span>
<ul>
<li ms-click="jobFun('')">请选择</li>
<li ms-repeat-el="artList.job" ms-click="jobFun(el.term_id)">{{el.name}}</li>
</ul>
</div>
</div>
<div class="btn"><button type="button" ms-click="SearchBut">Search</button></div>
</form>
</div>
<!-- results -->
<div class="srhResults">
<div ms-repeat-el="lists" class="srhItem">
<div class="hd fnt16">
<div class="txt">
<h2 class="fnt24">{{el.post_title}}</h2>
<div class="tt">
<span>Religion:{{el.religion}} </span>
<span>City:{{el.country}} </span>
<span>Job Type:{{el.job}} </span>
</div>
</div>
<a href="javascript:;" class="btn-Apply" ms-click="tooglebox">Apply</a>
</div>
<div class="bd fnt16">
<div class="box">
<div ms-html="el.post_content"></div>
<div class="btn-Apply"><a href="javascript:;" ms-click="tooglebox">Apply</a></div>
</div>
</div>
</div>
<div class="btn-more"><a href="javascript:;">Veiw more</a></div>
</div>
</div>
</div>
<script>
$(function(){
//result
// $('.btn-Apply').on('click',function (){
// $(this).parent().toggleClass('is-open');
// $(this).parent().next().slideToggle();
// })
/* select */
$(".select-item").on('click', function () {
$(".select-item").find('ul').stop().slideUp();
$(".select-item").removeClass('active');
$(this).find('ul').stop().slideDown('fast');
$(this).addClass('active').siblings().removeClass('active');
});
$(".select-item").on('click','ul li', function () {
const targetTt =$(this).text();
$(this).parent().prev('span').text(targetTt);
$(this).parents().removeClass('active');
$(this).parent().stop().slideUp();
return false; //阻止冒泡
});
$(document).click(function(event){
const _con = $('.select-item');
if(!_con.is(event.target) && _con.has(event.target).length === 0){
$(".select-item").find('ul').stop().slideUp();
$(".select-item").removeClass('active');
}
});
})
var vmm = avalon.define({
$id:"content_list",
religion:'',
country:'',
job:'',
offset:0,
artList:{},
lists:[],
tooglebox:function(){
$(this).parent().toggleClass('is-open');
$(this).parent().next().slideToggle();
},
religionFun:function(obj){
vmm.religion = obj;
},
countryFun:function(obj){
vmm.country = obj;
},
jobFun:function(obj){
vmm.job = obj;
},
SearchBut:function(){
var _this = this;
vmm.lists = [];
var dataes = {
religion:vmm.religion,
country:vmm.country,
job:vmm.job
};
$.ajax({
url:ajax_url,
type:'post',
dataType: 'json',
data:{
'action':'get_post_art_lists',
'datas':JSON.stringify(dataes)
},
success:function(result){
vmm.lists=result;
}
})
},
changeCategory:function(termid){
var _this = this;
$.ajax({
url:ajax_url,
type:'post',
dataType: 'json',
data:{
'action':'get_post_type_lists'
},
success:function(result){
vmm.artList=result;
vmm.SearchBut();
}
})
}
})
vmm.changeCategory();
</script>
<?php
return ob_get_clean();
}
/**Carass筛选简码开始*/
/**文章标签**/
add_shortcode('getTagFilter','getTagFilter_f');
function getTagFilter_f(){
echo the_tags( 'Tags: ', ', ', '' );
}
/**个人介绍*/
add_shortcode('getAutoaFilter','getAutoaFilter_f');
function getAutoaFilter_f(){
echo the_author_meta( 'description', );
}