<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class DHVC_Woo_Page_Shortcode {
private $_shortcode_added = false;
private $_single_product_display_attributes = array();
public function __construct() {
$this->init_hooks();
}
public function init_hooks(){
if($this->_shortcode_added){
return;
}
add_action( 'vc_load_shortcode', array($this,'add_shortcode' ));
add_action( 'template_redirect', array($this, 'add_shortcode' ),9);
add_action( 'dhvc_woocommerce_page_before_single_product_shortcode_content', array($this, 'add_shortcode' ),9);
$this->_shortcode_added = true;
}
public function add_shortcode(){
global $post;
foreach ( dhvc_woo_product_page_single_shortcodes() as $shortcode => $function ) {
if('product'===get_post_type($post)){
add_shortcode($shortcode , array($this,$function));
}else{
add_shortcode($shortcode , array($this,'shortcode_error2'));
}
}
if(defined( 'YITH_YWZM_DIR' )){
remove_shortcode('dhvc_woo_product_page_images');
add_shortcode ( 'dhvc_woo_product_page_images',array($this,'dhvc_woo_product_page_images_shortcode_custom') );
}
foreach ( dhvc_woo_product_page_wc_shortcodes() as $shortcode => $function ) {
add_shortcode( $shortcode , array( $this, $function ) );
}
do_action('dhvc_woocommerce_page_after_add_shortcode');
}
public function shortcode_error($atts='',$content='',$tag=''){
return '<em style="color:red;display:block">Use shortcode "'.$tag.'" is wrong (Please view Product after assigning Custom Template), to use plugin please see <a target="_blank" href="https://www.youtube.com/watch?v=DhqOQdR7K_8">Video</a><br><br></em>';
}
public function shortcode_error2($atts='',$content='',$tag=''){
return '<em style="display: block; color: rgb(51, 51, 51); font-weight: bold; white-space: pre-wrap;">Shortcode "'.ucwords(str_replace(array('dhvc_woo','_'), array('Single ',' '), $tag)).'". <i style="font-size: inherit; color: rgb(255, 0, 0); font-weight: normal;">Please view Product after assigning Custom Template</i></em>';
}
public function dhvc_woo_product_page_fpd($atts){
extract ( dhvc_woo_page_shortcode_atts ( array (
'el_class' => '',
'css' => '',
), $atts ) );
$el_class .= $this->_get_vc_shortcode_custom_css_class($css);
ob_start ();
echo '<style type="text/css">#fpd-start-customizing-button~#fpd-start-customizing-button{display:none}</style>';
$FPD_Frontend_Product = new FPD_Frontend_Product;
$FPD_Frontend_Product->add_product_designer();
return !empty($el_class) ? '<div class="dhvc-woo-product-page-fpd '.$el_class.'">'.ob_get_clean().'</div>' : ob_get_clean();
}
public function dhvc_woo_product_page_images_shortcode_custom($atts, $content = null){
extract ( dhvc_woo_page_shortcode_atts ( array (
'el_class' => '',
'css' => '',
), $atts ) );
$el_class .= $this->_get_vc_shortcode_custom_css_class($css);
ob_start ();
$wc_get_template = function_exists( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
$wc_get_template( 'single-product/product-image-magnifier.php', array(), '', YITH_YWZM_DIR . 'templates/' );
return !empty($el_class) ? '<div class="'.$el_class.'">'.ob_get_clean().'</div>' : ob_get_clean();
}
protected function _get_vc_shortcode_custom_css_class($param_value, $prefix = ' ' ){
return dhvc_woo_page_get_shortcode_custom_css_class($param_value,$prefix);
}
public function dhvc_woo_product_page_acf_field_shortcode($atts, $content = null) {
extract ( dhvc_woo_page_shortcode_atts ( array (
'label' => '',
'field' => '',
'el_class' => '',
'css' => '',
), $atts ) );
if (empty ( $field )) {
return '';
}
$el_class .= $this->_get_vc_shortcode_custom_css_class($css);
ob_start ();
echo '<div class="dhvc_woo_product_page_acf_field ' . $el_class . '">';
if(!empty($label)){
echo '<span class="acf_field_label">'.esc_html($label).'</span>';
}
//the_field ( $field );
$value = get_field($field);
//filter to custom display
$value = apply_filters('dhvc_woo_product_page_acf_field', $value, $field);
if( is_array($value) )
{
$value = @implode(', ',$value);
}
echo do_shortcode($value);
echo '</div>';
return ob_get_clean ();
}
public function dhvc_woo_product_page_images_shortcode($atts, $content = null) {
global $product;
extract ( dhvc_woo_page_shortcode_atts ( array (
'slider_type' => 'default',
'enable_zoom' => '',
'enable_lightbox' => '',
'thumbnails_columns'=> 4,
'el_class' => '' ,
'css' => '',
), $atts ) );
$thumbnails_columns = absint($thumbnails_columns);
$el_class .= $this->_get_vc_shortcode_custom_css_class($css);
ob_start ();
if('default'!==$slider_type){
wp_enqueue_script('dhvc-woo-product-single',DHVC_WOO_PAGE_URL.'/assets/js/single-product.js',array('jquery','slick'),DHVC_WOO_PAGE_VERSION,true);
if('yes'===$enable_zoom && !current_theme_supports( 'wc-product-gallery-zoom' )){
wp_enqueue_script( 'zoom', plugins_url( 'assets/js/zoom/jquery.zoom.min.js', WC_PLUGIN_FILE ),array( 'jquery' ),'1.7.21',true);
}
if('yes'===$enable_lightbox && !current_theme_supports( 'wc-product-gallery-lightbox' )){
wp_register_script( 'photoswipe', plugins_url( 'assets/js/photoswipe/photoswipe.min.js', WC_PLUGIN_FILE ),array(),'4.1.1',true);
wp_enqueue_script( 'photoswipe-ui-default', plugins_url( 'assets/js/photoswipe/photoswipe-ui-default.min.js', WC_PLUGIN_FILE ),array( 'photoswipe' ),'4.1.1',true);
wp_register_style( 'photoswipe', plugins_url( 'assets/css/photoswipe/photoswipe.css', WC_PLUGIN_FILE ),array(),'4.1.1');
wp_enqueue_style( 'photoswipe-default-skin', plugins_url( 'assets/css/photoswipe/default-skin/default-skin.css', WC_PLUGIN_FILE ),array( 'photoswipe' ),'4.1.1');
add_action( 'wp_footer', array($this,'_photoswipe_template'),100);
}
$gallery_class = 'no-thumbnails';
$thumbnail_size = apply_filters('dhvc_woo_page_single_product_gallery_thumbnail_size', 'woocommerce_gallery_thumbnail');
$post_thumbnail_id = $product->get_image_id();
$gallery_html = $thumbnail_html = $main_thumbnail_html = '';
add_filter('woocommerce_gallery_image_size', array($this,'_change_woocommerce_gallery_image_size'),10000);
$galleryAsMainImage = true;
if ( $post_thumbnail_id ) {
if( apply_filters('dhvc_woo_page_single_product_gallery_use_main_image', true) ){
$galleryAsMainImage = false;
$post_thumbnail_url = wp_get_attachment_image_url( $post_thumbnail_id, $thumbnail_size );
$main_thumbnail_html .= '<div class="woocommerce-product-gallery__thumbnail"><div class="slick-image--border">'.sprintf( '<img src="%s" data-o_src="%s" />', $post_thumbnail_url, $post_thumbnail_url ).'</div></div>';
$gallery_html = wc_get_gallery_image_html( $post_thumbnail_id, true );
}
} else {
$gallery_html = '<div class="woocommerce-product-gallery__image--placeholder">';
$gallery_html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src( 'woocommerce_single' ) ), esc_html__( 'Awaiting product image', 'woocommerce' ) );
$gallery_html .= '</div>';
}
$gallery_html = apply_filters( 'woocommerce_single_product_image_thumbnail_html', $gallery_html, $post_thumbnail_id );
$attachment_ids = $product->get_gallery_image_ids();
if ( $attachment_ids && $post_thumbnail_id ) {
$gallery_class = 'with-thumbnails';
$thumbnail_html .= $main_thumbnail_html;
$i = 0;
foreach ( $attachment_ids as $attachment_id ) {
$i ++;
$post_thumbnail_url = wp_get_attachment_image_url( $attachment_id, $thumbnail_size );
$thumbnai
没有合适的资源?快使用搜索试试~ 我知道了~
【WordPress插件】2022年最新版完整功能demo+插件v5.2.24.zip
共106个文件
php:74个
svg:10个
js:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 18 浏览量
2022-03-31
19:51:54
上传
评论
收藏 271KB ZIP 举报
温馨提示
"【WordPress插件】2022年最新版完整功能demo+插件v5.2.24 DHWCPage - WooCommerce Page Template Builder DHWCPage - Woocommerce页面模板构建器" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart主题、PHP项目源码、安卓项目源码、ios项目源码,更有超10000个资源可供选择,如有需要请站内联系。
资源推荐
资源详情
资源评论
收起资源包目录
【WordPress插件】2022年最新版完整功能demo+插件v5.2.24.zip (106个子文件)
style.css 15KB
chosen.min.css 11KB
admin.css 3KB
admin.css 2KB
slick.js 87KB
slick.min.js 42KB
single-product.dev.js 9KB
single-product.js 5KB
admin.js 5KB
vc-frontend.js 1KB
vc-page-editable.js 840B
admin.js 453B
style.less 13KB
shortcode.php 32KB
vc.php 32KB
product.php 27KB
class-checkout-form-editor-admin.php 25KB
functions.php 22KB
class-checkout-form-editor.php 20KB
woocommerce.php 15KB
account.php 15KB
product.php 15KB
checkout.php 14KB
checkout.php 13KB
cart.php 13KB
account.php 12KB
vc-frontend-editor.php 9KB
archive.php 8KB
cornerstone.php 8KB
admin.php 8KB
admin-setting.php 8KB
account.php 7KB
cart.php 6KB
editor_frontend.tpl.php 5KB
checkout.php 5KB
dhvc-woocommerce-page.php 5KB
frontend.php 4KB
post-types.php 4KB
cart.php 4KB
archive.php 3KB
definition.php 3KB
fusion-builder.php 3KB
definition.php 2KB
vc-functions.php 2KB
archive.php 2KB
definition.php 2KB
vc-backend-editor.php 2KB
definition.php 2KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
definition.php 1KB
archive-product.php 980B
definition.php 899B
form-checkout.php 746B
content-single-product.php 721B
definition.php 568B
definition.php 530B
definition.php 525B
definition.php 525B
definition.php 522B
definition.php 518B
definition.php 516B
definition.php 512B
definition.php 508B
definition.php 508B
definition.php 508B
definition.php 506B
definition.php 505B
definition.php 504B
definition.php 501B
definition.php 500B
definition.php 497B
definition.php 496B
definition.php 492B
definition.php 490B
definition.php 481B
form-login.php 315B
order-receipt.php 195B
thankyou.php 191B
cart.php 180B
cart-empty.php 155B
single-product.php 117B
woocommerce.png 4KB
single-product.png 2KB
chosen-sprite@2x.png 872B
chosen-sprite.png 646B
dhvc-woocommerce-page.pot 84KB
dhwc-page-builder.svg 12KB
dhvc-page.svg 12KB
archive.svg 5KB
checkout.svg 5KB
account.svg 5KB
single-product.svg 5KB
shop.svg 5KB
cart.svg 5KB
共 106 条
- 1
- 2
资源评论
Lee达森
- 粉丝: 969
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功