Different repeat posting in slider topics

Dear all
I learned in this thread how to deactivate the slider for mobiles only. Worked very well for me.

However, I typically do not repeat the postings which are in the slider in the list of postings below. Which means, when I introduce the code given there, my latest postings are not shown on the main access page for a mobile at all. Can I change this slider setting for mobile only?

Thanks,
Florian

Hello Florian

Last part of the question is not clear :frowning: can you tell me what is your goal?
also, include link to your website

“Can I change this slider setting for mobile only?” - No, there is no such setting

Sorry for being unclear.

Let’s say my ten recent postings are A, B, C, D, E, F, G, H, I and J. I selected the four newest postings, A to D for my slider. As I show six postings per page, E to J will be presented underneath as I activated the Check to exclude slider post from Homepage posts .

If I now deactivate the slider with the code, the slider is gone, but it still displays the postings E to J on the website. I would rather like to see A to F on the mobile version instead. Can I customize that selection, depending on the device / whether the slider is active or not?

Thanks a lot,
Florian

Hello @flyctory,

So you want to have a different set of slides available for the mobile and desktop version of the website?

Let me know if that is correct.

Best Regards,
Support

Hi,
I would like to do to things:

  • No slider on mobile phone resolution -> made it
  • The visitor is able to see the latest postings. For desktops, these are in the slider (A to D in my example) plus the ones automatically shown below (E to J). However, when I deactivate the slider for mobiles by the code, it still shows E to J as the postings, A to D are "hidden" because the option to exclude slider posts from homepage posts is still applied and A to D are seen as slider posts, though there is no slider any more. There seems to be a global routine to select the latest postings shown underneath the slider - and I would like to customize the selection depending on the machine the visitor is using.

Hope it becomes clearer…

Thanks,
Florian

Hello @flyctory,

Thanks for clarifying.

In this case, you will have to add a condition to remove the mobile slider feature. This code should help:


function remove_travelify_actions(){

if( wp_is_mobile() ){
	remove_all_actions( 'travelify_featured_post_slider' );
	remove_all_actions('travelify_featured_post_slider');
}
}
add_action('init', 'remove_travelify_actions');

If this still does not work then you would need to enlist the aid of a third party developer because this will require more complex code and support than we can provide here. You can find a developer here:
https://colorlib.com/out/envatostudio

Best Regards,
Support

Hi,
unfortunately, it did not work, but with your thoughts, I somehow could solve it. Around line 260 in the functions.php, there is the code, which manipulates selection of postings to be displayed, depending on the setting I mentioned:

		if ( $options[ 'exclude_slider_post'] != "0" && !empty( $options[ 'featured_post_slider' ] ) ) {
			if( $query->is_main_query() && $query->is_home() ) {
				$query->query_vars['post__not_in'] = $options[ 'featured_post_slider' ];
			}
		}

I just conditioned it, in addition to the php I linked before:

	if( !wp_is_mobile() ){
		if ( $options[ 'exclude_slider_post'] != "0" && !empty( $options[ 'featured_post_slider' ] ) ) {
			if( $query->is_main_query() && $query->is_home() ) {
				$query->query_vars['post__not_in'] = $options[ 'featured_post_slider' ];
			}
		}
	}

Finally, so easy… Thanks a lot for your support… Without all the help, I would not have dared to manipulate the php :slight_smile:

That’s great :slight_smile:
I will close this case now, Feel free to contact us again if you have other questions Thanks!