Skip Navigation

[Fermé] Marquee in stead of carousel

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Marqué : 

This topic contains 1 réponse, has 2 voix.

Last updated by Riccardo Strobbia Il y a 6 années et 7 mois.

Assigned support staff: Riccardo Strobbia.



I'm not very experienced with WP and coding but I would like to use a marquee instead of using the carousel. How would you suggest I go about doing this?


Dear Nthulanem,

if you downloaded our Bootstrap 3 Demo for Layouts theme, you will find a dd-layouts-cells folder with a bunch of example custom cells.

What I suggest is to create a custom cell specifically for the marquee slider.

You can start by creating a layouts-marquee-slider-cell.php files in the dd-layouts-cells folder with this content:

 * Marquee-slider cell type.
 * Bootstrap thumbnail component that displays box with image, header and text. Suitable for callout boxes, key features, services showcase etc.

if ( ! function_exists('register_marquee-slider_cell_init') )
	function register_marquee_slider_cell_init() {
		if ( function_exists('register_dd_layout_cell_type') ) {
			register_dd_layout_cell_type ('marquee-slider-cell',
					'name'					   => __('Marquee-slider', 'wpbootstrap'),
					'icon-css'				   => 'icon-picture',
					'description'			   => __('A cell that displays box with image, header and text. Suitable for callout boxes, key features, services showcase etc.', 'wpbootstrap'),
					'category'				   => __('Example cells', 'wpbootstrap'),
					'category-icon-css'		   => 'icon-sun',
					'button-text'			   => __('Assign marquee-slider cell', 'wpbootstrap'),
					'dialog-title-create'	   => __('Create a new marquee-slider cell', 'wpbootstrap'),
					'dialog-title-edit'		   => __('Edit marquee-slider cell', 'wpbootstrap'),
					'dialog-template-callback' => 'marquee_slider_cell_dialog_template_callback',
					'cell-content-callback'	   => 'marquee_slider_cell_content_callback',
					'cell-template-callback'   => 'marquee_slider_cell_template_callback',
					'preview-image-url'		   => get_template_directory_uri() . '',
					'register-scripts'		   => array(
						array( 'ddl_media_uploader_js', get_template_directory_uri() . '', array( 'jquery' ), WPDDL_VERSION, true ),
					'translatable_fields'	   => array(
						array('name' =>'box_title', 'title' => 'Box Title', 'type' => 'LINE'),
						array('name' => 'box_content', 'title' => 'Box Content', 'type' => 'AREA')
add_action( 'init', 'register_marquee_slider_cell_init' );

function marquee_slider_cell_dialog_template_callback() {

		<?php the_ddl_cell_info('name'); ?>
	<ul class="ddl-form">
			<label for="<?php the_ddl_name_attr('box_title'); ?>"><?php _e('Cell title', 'wpbootstrap') ?>:</label>
			<input type="text" name="<?php the_ddl_name_attr('box_title'); ?>">
			<h3><?php _e('Slides', 'ddl-layouts'); ?></h3>

			<?php ddl_repeat_start( 'slider', __( 'Add another slide', 'ddl-layouts' ), 10 ); ?>

			<div class="js-ddl-media-field">
				<label for="<?php the_ddl_name_attr('slide_url'); ?>"><?php _e( 'Image', 'ddl-layouts' ) ?>:</label>
				<input type="text" class="js-ddl-media-url" name="<?php the_ddl_name_attr('slide_url'); ?>" />
				<p class="ddl-form-button-wrap">
					<button class="button js-ddl-add-media"
					data-uploader-title="<?php _e( 'Choose an image', 'ddl-layouts' ) ?>"
					data-uploader-button-text="Insert image URL"><?php _e( 'Choose an image', 'ddl-layouts' ) ?>
			<label for="<?php the_ddl_name_attr('slide_title'); ?>"><?php _e( 'Caption title', 'ddl-layouts' ) ?>:</label>
			<input type="text" name="<?php the_ddl_name_attr('slide_title'); ?>">
			<label for="<?php the_ddl_name_attr('slide_text'); ?>"><?php _e( 'Caption description', 'ddl-layouts' ) ?>:</label>
			<textarea name="<?php the_ddl_name_attr('slide_text'); ?>" rows="3"></textarea>
			<span class="desc"><?php _e('You can add HTML to the slide description.', 'ddl-layouts'); ?></span>

		<?php ddl_repeat_end(); ?>

return ob_get_clean();

	// Callback function for displaying the cell in the editor.
function marquee_slider_cell_template_callback() {
	return 'box_title';

	// Callback function for display the cell in the front end.
function marquee_slider_cell_content_callback() {

			ul.slide li{float:left;
				ul.slide img{border:1px solid silver;

	<script type="text/javascript">
			//Plugin start
				var methods = 
					init : function( options ) 
						return this.each(function()
							var _this=$(this);'marquee',options);
							var _li=$('>li',_this);

							_this.wrap('<div class="slide_container"></div>')

							for(var i=0;i<Math.ceil((screen.width*3)/_this.width());++i)


						var $this=this;



				$.fn.marquee = function(m) 
					var settings={

					if(typeof m === 'object' || ! m)
							$.extend( settings, m );

						return methods.init.apply( this, [settings] );
						return methods[m].apply( this);
			)( jQuery );

 //Plugin end

<ul class="slide">
	<?php while ( has_ddl_repeater('slider') ) : the_ddl_repeater('slider'); ?>

		<li class="item <?php if (get_ddl_repeater_index() == 0) { echo ' active'; } ?>"
                        <?php // Cover image to slide
                        if( get_ddl_field('image_size') == 'cover' ): ?>
                        style="background: url(<?php the_ddl_sub_field('slide_url'); ?>) no-repeat; background-size:cover;"
                    <?php endif;?>
                    <?php if( get_ddl_field('image_size') == '' ): ?>
                    	<img src="<?php the_ddl_sub_field('slide_url'); ?>">
                    <?php endif;?>    
                    <div class="carousel-caption">
                    		<?php the_ddl_sub_field('slide_title'); ?>
                    		<?php the_ddl_sub_field('slide_text'); ?>

            <?php endwhile; ?>

        return ob_get_clean();

This code is only a - working - proof of concept but needs fine tuning (some simple CSS and Javascript work is required to adjust the width and the style of the slider, but most of it should be already in place).

Once the file will be created you will find an additional cell you can add to your layouts, please test it and fine tune it reading the code carefully.

Hope this helps, best regards

Le sujet ‘[Fermé] Marquee in stead of carousel’ est fermé à de nouvelles réponses.