677dd3e1 by Jeff Balicki

slider

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 7768501f
......@@ -11,6 +11,7 @@ include 'inc/shortcodes.php';
include 'inc/blocks.php';
include 'inc/shortcodes-resources.php';
include 'inc/menu.php';
include 'inc/shortcodes-contest.php';
/**
......
<?php
add_shortcode('contest-slider', 'contest_slider');
function contest_slider(){
$custom_args = array(
'post_type' => 'nf_sub',
'posts_per_page' => 3,
'paged' => 1,
'post_status' => 'any',
'order' => 'DESC',
'orderby' => 'rand',
// 'meta_query' => array(
// 'relation' => 'AND',
// array(
// 'key' => '_form_id',
// 'value' => '2',
// 'compare' => '=',
// ),
// ),
);
$custom_query = new \WP_Query($custom_args);
ob_start();
$uniqid = uniqid();
if ($custom_query->have_posts()): ?>
<div id="<?php echo esc_attr($uniqid); ?>" class="<?php echo esc_attr($className); ?> ">
<div class="content-item carousel-items <?php echo $size; ?>">
<div class='swiper-wrapper'>
<?php while ($custom_query->have_posts()): $custom_query->the_post(); ?>
<div class="swiper-slide">
<?php $image = get_post_meta(get_the_ID(), '_field_11', true );
$num = get_post_meta(get_the_ID(), '_seq_num', true );
$cap = get_post_meta(get_the_ID(), '_field_8', true );
?>
<img src="<?php echo $image[$num];?>" alt="<?php echo $cap;?>">
<div class="contest_cap"><?php echo $cap;?></div>
</div>
<?php endwhile; ?>
</div>
</div>
<div class="swiper-button-prev" data-id="<?= $uniqid ?>"></div>
<div class="swiper-button-next" data-id="<?= $uniqid ?>"></div>
</div>
<?php endif;
wp_reset_query();
$output = ob_get_clean();
return $output;
}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -43,7 +43,9 @@
"homepage": "https://understrap.com",
"dependencies": {
"datatables.net-bs5": "^1.13.2",
"jquery": "^3.6.3"
"jquery": "^3.6.3",
"rollup-plugin-postcss": "^4.0.2",
"swiper": "^9.0.5"
},
"devDependencies": {
"@babel/core": "^7.19.6",
......@@ -63,7 +65,7 @@
"font-awesome": "^4.7.0",
"nodemon": "^2.0.20",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.18",
"postcss": "^8.4.21",
"postcss-cli": "^10.0.0",
"postcss-understrap-palette-generator": "git+https://github.com/understrap/postcss-understrap-palette-generator.git",
"rollup": "^3.2.5",
......
......@@ -9,6 +9,7 @@ const { nodeResolve } = require( '@rollup/plugin-node-resolve' );
const commonjs = require( '@rollup/plugin-commonjs' );
const multi = require( '@rollup/plugin-multi-entry' );
const replace = require( '@rollup/plugin-replace' );
const postcss = require('rollup-plugin-postcss');
/**
* Internal dependencies
......@@ -39,6 +40,9 @@ const plugins = [
nodeResolve(),
commonjs(),
multi(),
postcss({
plugins: []
})
];
module.exports = {
......
import Swiper, {
Navigation,
Pagination,
A11y,
Keyboard
} from 'swiper';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
import 'swiper/css/keyboard';
import 'swiper/css/a11y';
jQuery(document).ready(function($) {
$('.carousel-items').each(function() {
var offset = 0,
PerView = 3,
space = 30,
SlidesPerGroup = 1,
offsetAfter = 0,
_id = $(this).attr('id');
var swiper_params = {
modules: [Navigation, Pagination, A11y, Keyboard],
slidesPerView: PerView,
slidesOffsetAfter: offsetAfter,
slidesOffsetBefore: offset,
spaceBetween: space,
slidesPerGroup: SlidesPerGroup ,
pagination: {
el: ".swiper-pagination",
type: 'bullets',
clickable: "true",
},
navigation: {
nextEl: '.swiper-button-next[data-id="' + _id + '"]',
prevEl: '.swiper-button-prev[data-id="' + _id + '"]',
},
a11y: {
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
},
keyboard: {
enabled: true,
onlyInViewport: false,
},
};
new Swiper(this, swiper_params);
});
//text_change();
function text_change(){
var words = [ 'Dance', 'Smile','Party','Sing',''];
$.each(words, function( index, value ) {
setTimeout( function(){
$(".like-you strong").text(value);
if( (words.length - 1) == index){
text_change();
}
}, index * 1000 );
});
}
});
\ No newline at end of file
jQuery(document).ready(function($) {
text_change();
function text_change(){
var words = [ 'Dance', 'Smile','Party','Sing',''];
$.each(words, function( index, value ) {
setTimeout( function(){
$(".like-you strong").text(value);
if( (words.length - 1) == index){
// text_change();
}
}, index * 1000 );
});
}
});
\ No newline at end of file
......@@ -2,6 +2,7 @@ import jQuery from 'jquery';
import DataTable from 'datatables.net-bs5';
import "./_resources_list";
import "./_contest";
var a = document.querySelector('.blur-image');
......@@ -21,17 +22,5 @@ document.addEventListener("DOMContentLoaded", function() {
});
jQuery(document).ready(function($) {
text_change();
function text_change(){
var words = [ 'Dance', 'Smile','Party','Sing',''];
$.each(words, function( index, value ) {
setTimeout( function(){
$(".like-you strong").text(value);
if( (words.length - 1) == index){
text_change();
}
}, index * 1000 );
});
}
});
......