Skip Navigation

[Resolved] Slider views not from toolset

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Akhil 5 years, 5 months ago.

Assisted by: Waqar.

Author
Posts
#1160496

Hi Nigel.

I want to use this snippet for my slide : hidden link
i know there is slider in toolset built in somehow i dont like that , it very slow.

Could you guide me pls.
Do i need to create multiple views for the different fields?

Thanks !

#1160644

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Dee,

Thank you for contacting us.

Nigel is away until early next week, but I'll be happy to assist with this question.

To include that custom slider in your view, you can follow these steps:

1. Create a new view or open an existing one for editing and set it to show posts from where you'd like to get the slider's data. Please also make sure that "No pagination" option is set under "Pagination and Sliders Settings" section.

2. In the view's "CSS editor" tab under the "Loop editor" section, copy all CSS code from the "CSS" tab on that snippet's page.
( screenshot: hidden link )

3. Similarly, in the "JS editor" tab right below it, copy the code from the "JS" tab.

4. Next, you'll need a custom shortcode that will generate the pagination HTML for the slider, based on the number of results found in the view.

For this, you can add the following PHP code, in your active child theme's "functions.php" file:


add_shortcode('show_custom_slider_pagination', 'show_custom_slider_pagination_fn');
function show_custom_slider_pagination_fn($atts) {
     
	$count = $atts['count'];

	if ($count >= 1 )
	{
		ob_start();
		echo '<!-- Indicators -->';
		echo '<ol class="carousel-indicators">';

		for ($i=0; $i < $count ; $i++)
		{
			if ($i == 0)
			{
				$active = 'class="active"';
			}
			else
			{
				$active = '';
			}

			echo '<li data-target="#mogo-slider" data-slide-to="'.$i.'" '.$active.'>';
			echo '<div class="indicator-inner">';
			echo '<span class="number">0'.($i + 1).'</span>';
			echo '<span class="text text-uppercase">Intro</span>';
			echo '</div>';
			echo '</li>';
		}
	}

		echo '</ol>';
	return ob_get_clean();
	 
}

Note: You can replace the text "Intro" with actual value from the custom field that you'd like to show here.
( screenshot: hidden link )

Once this code has been added, you'll be able to use this shortcode to show the slider's pagination like this:


[show_custom_slider_pagination count="[wpv-found-count]"]

5. To show the loop and HTML in the view's "Loop editor" section, you can replace the existing code with the following:


[wpv-layout-start]
  [wpv-items-found]
    
    <!-- Slider start -->
    <div class="slider">
      <div class="slider-wrap">
        <div class="container">
          <div class="row">
            <div class="col-md-12">
              <div id="mogo-slider" class="carousel slide" data-ride="carousel">
                <!-- Wrapper for slides -->
                <div class="carousel-inner text-center" role="listbox">

                  <!-- wpv-loop-start -->
                    <wpv-loop>
                      [wpv-item index=1]
                      	<div class="item active">
                          [wpv-post-body view_template="slug-of-content-template"]
                        </div>  
                      [wpv-item index=other]
                      	<div class="item">
                          [wpv-post-body view_template="slug-of-content-template"]
                        </div>
                    </wpv-loop>
                  <!-- wpv-loop-end -->
	
                </div>
                [show_custom_slider_pagination count="[wpv-found-count]"]	
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  <!-- End of slider -->

  [/wpv-items-found]
  [wpv-no-items-found]
    <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
  [/wpv-no-items-found]
[wpv-layout-end]

Note: the shortcode for the pagination is already included at the correct place and you'll only need to update all instances of "slug-of-content-template" to match the slug of your view's content template.

6. In the view's content template section you can include the code for each slider item like this:


<div class="slider-content">
	<p class="slider-caption">
		Creative Template
	</p>
	<h3 class="slider-titile text-uppercase">
		Welcome <br> to mogo
	</h3>
	<span class="verticle-bar"></span>
	<div class="btn-action">
		<a href="#" class="btn btn-primary">Learn More</a>
	</div>
</div>

Note: In this example, I've used hardcoded values, but you can replace them with dynamic custom field values, accordingly.

Important note: If the Bootstrap's CSS and JS file is not being included on the website, by your theme or by Toolset, you'll also need to include the following lines to load them above the comment line "<!-- Slider start -->", in step 5.


<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

I hope this helps and let me know if you have any questions around any of these steps.

regards,
Waqar

#1161302

Thank you for taking this ticket.

impressive. I'll test this and update you soonest.
Have a great day Waqar.

#1161355

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

You're welcome, Dee.

I'll wait for an update and have a great day.

#1162413

My issue is resolved now. Thank you!

#1165294

Hi. I'm trying to add the toolset into the snippets,
I've added like this but it's displaying only the $field.

function show_custom_slider_pagination_fn($atts, $postarr) {
...
$field = $postarr['wpcf']['project-name'];
.
.
echo '<span class="text text-uppercase"> .$field </span>';

is there anything I'm doing it wrong ? thanks

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.