• Hi,
    Synch Theme have a slider scrolling with arrows on sides, in homepage.
    It’s cool but i want to create an automatic slide of this.
    Is it possible ? Any solution?
    https://www.docsideproduction.fr/test/
    Thanks
    ———Code header.php

    <div id="videos">
    <?php if (is_home() && getThemeOption('enable_slider') && getThemeOption('max_items_in_slider') !== 0) include 'synch-slider.php'; ?>
    <?php if (is_single()):
    	$embed_code = getAutoEmbedCode(get_the_ID().'single');
    	if ($embed_code):
    	?>
    <div class="video"><?php echo $embed_code ?></div>
    	<?php
    	endif;
    endif ?>
    </div>

    ———Code synch-slider.php

    <?php
    global $post, $exclude_posts;
    $args = array('meta_key' => 'synch_slider', 'meta_value' => 'on');
    if (getThemeOption('max_items_in_slider') == '')
    {
    	$args['numberposts'] = -1;
    }
    else
    {
    	$args['numberposts'] = getThemeOption('max_items_in_slider');
    }
    $slider_posts = get_posts($args);
    if (empty($slider_posts)) return;
    
    if (getThemeOption('slider_type') == 1):
    ?>
    
    <div class="wrapper">
    	<div class="header_video">
    	<?php for ($i = 0, $count = count($slider_posts); $i < $count; $i++):
    		$post = $slider_posts[$i];
    		setup_postdata($post);
    		if (getThemeOption('exclude_slider_posts')) $exclude_posts[] = $slider_posts[$i]->ID;
    	?>
    		<div id="slider_video_<?php the_ID() ?>"<?php echo $i == 0 ? '' : ' style="display: none;"' ?>>
    		<?php
    		$embed_code = getAutoEmbedCode(get_the_ID().'slider', 620, 349);
    		if ($embed_code):
    		?>
    			<?php echo $embed_code ?>
    		<?php else: ?>
    			<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('slider', array('alt' => '', 'title' => '')) ?></a>
    		<?php endif ?>
    		</div>
    	<?php endfor ?>
    	</div>
    	<div id="header_video_selector">
    	<?php for ($i = 0, $count = count($slider_posts); $i < $count; $i++):
    		$post = $slider_posts[$i];
    		setup_postdata($post);
    	?>
    		<div id="slider_selector_<?php the_ID() ?>" class="item<?php if ($i == 0) echo ' active' ?>" onclick="sliderVideo(<?php the_ID() ?>)">
    			<div>
    				<?php the_title() ?>
    				<div><?php synch_posted_on() ?> · <?php echo get_the_tag_list(', ') ?>  · <a href="<?php the_permalink() ?>">Permalink</a></div>
    			</div>
    		</div>
    	<?php endfor ?>
    	</div>
    	<div class="clear"></div>
    </div>
    
    <script type="text/javascript">
    var slider_api;
    $(document).ready(function() {
    	var pane = $('#header_video_selector');
    	pane.jScrollPane({
    		animateScroll: true
    	});
    	slider_api = pane.data('jsp');
    });
    </script>
    
    <?php else: ?>
    
    <div class="container_wrapper">
    	<a class="left"></a>
    	<a class="right"></a>
    	<div class="container">
    		<table>
    			<tr>
    	<?php for ($i = 0, $count = count($slider_posts); $i < $count; $i++):
    		$post = $slider_posts[$i];
    		setup_postdata($post);
    		if (getThemeOption('exclude_slider_posts')) $exclude_posts[] = $slider_posts[$i]->ID;
    	?>
    				<td>
    					<div class="header_video">
    						<?php
    						$embed_code = getAutoEmbedCode(get_the_ID().'slider', 620, 349);
    						if ($embed_code):
    						?>
    						<?php echo $embed_code ?>
    						<?php else: ?>
    						<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('slider', array('alt' => '', 'title' => '')) ?></a>
    						<?php endif ?>
    					</div>
    					<div class="info">
    						<div class="categories"><?php echo get_the_tag_list(' ') ?></div>
    						<h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
    
    						<?php the_excerpt() ?>
    					</div>
    					<div class="clear"></div>
    				</td>
    	<?php endfor ?>
    			</tr>
    		</table>
    	</div>
    </div>
    
    <script type="text/javascript">
    var videos = 1;
    var total_videos = $('#videos td').length;
    var video_width = 940;
    if (total_videos > 1)
    {
    	$('#videos .right').addClass('right_a');
    
    	var smallest_video_margin = (videos - total_videos) * video_width;
    	var video_margin = 0;
    
    	$('#videos .left').click(function(e) {
    		if (video_margin < 0)
    		{
    			video_margin += video_width;
    			animateVideoMargin();
    			fixLeftVideoMove();
    		}
    	});
    
    	$('#videos .right').click(function(e) {
    		if (video_margin > smallest_video_margin)
    		{
    			video_margin -= video_width;
    			animateVideoMargin();
    			fixRightVideoMove();
    		}
    	});
    
    	function animateVideoMargin()
    	{
    		if (total_videos > videos)
    		{
    			$('#videos table').animate({
    				'marginLeft': video_margin + "px"
    			});
    		}
    	}
    
    	function fixRightVideoMove()
    	{
    		if (video_margin == smallest_video_margin) $('#videos .right').removeClass('right_a');
    		if (video_margin < 0 && !$('#videos .left').hasClass('left_a')) $('#videos .left').addClass('left_a');
    	}
    
    	function fixLeftVideoMove()
    	{
    		if (video_margin == 0) $('#videos .left').removeClass('left_a');
    		if (video_margin > smallest_video_margin && !$('#videos .right').hasClass('right_a')) $('#videos .right').addClass('right_a');
    	}
    }
    </script>
    
    <?php endif; ?>

Viewing 1 replies (of 1 total)
  • You’ll need to contact the theme vendor/developer for help – as these forums only support themes from the repository on this site.

Viewing 1 replies (of 1 total)
  • The topic ‘An automatic slider with Synch Theme’ is closed to new replies.