One click to generate image sharing with QR code should be used by those who do blogging and other resource sites!
![Picture [2] - WordPress poster automatic generation function: a key to generate images to share with QR code - Photon Fluctuation Network - Free sharing of cross-border knowledge and technical knowledge](https://www.361sale.com/wp-content/uploads/2024/04/image-526.png)
It is also relatively simple to implement this feature.
Prep: Unzip the following zip file and copy all the files you get to the theme folder
Step 1: Modify the theme file functions.php by adding the following code at the end of it
require_once get_template_directory() . '/poster/index.php';
Step 2: Modify the theme file single-product.php
Find the following code (near line 42)
<a class="xs-btn c-btn" data-fancybox="video-gallery" data-width="800" data-height="480" href="/en/</?php the_field('product-jiaocheng')?>"><i class="iconfont icon-shipin mr-10"></i>Share Poster</a>
Replace it with
Step 3: Modify the theme file footer.php
Find these codes below (near line 34)
<div class="apply clearfix bg-white position-fixed rounded-lg overflow-hidden d-block d-xl-none">
Add the following code to it
Step 4: Modify the theme file js/xs.js
Add the following code at the end of it
(function($) {
var inited = 0
$('.poster-trigger').on('click', function() {
var $_this = $(this)
if($_this.hasClass('disabled')) {
if($_this.hasClass('disabled')) {
}
$_this.addClass('disabled')
if(inited) {
poster_toggle_poster_md(1)
$_this.removeClass('disabled')
return
}
var id = $_this.attr('data-id')
if(!id) {
$_this.removeClass('disabled')
return
}
$.ajax({
url: tbdz.ajax_url, type: 'GET', {
dataType: 'json', { data: { tbdz.ajax_url, type: 'GET', }
data: {
action: 'get_poster',
id: id
}, success: function(data) { action: 'get_poster', id: id
success: function(data) {
$('#dz-poster-modal .justify-content-center').remove()
$_this.removeClass('disabled')
if(!data.result) {
$('#dz-poster-modal .dz-pst-img').append('<p class="dz-tip">Poster generation failed, please try again</p>')
} else if(data.poster) {
inited = 1
$('#dz-poster-modal .dz-pst-img').append('<img class="img-fluid" src="'+data.poster+'">')
}
}
})
})
})(jQuery);



- newest
- hottest
See only the author.