Before you ask please READ THIS

randomly select short code (rife pro / elementor)

in Rife Posts: 199
Hi Air

Already came up with a new question (so you don't get bored ;))
For an upcoming website my clients will need a video clip (automatically) starting using the image from frame 1 as poster image and after the clip has finished playing the video should "freeze" with the last image of the clip.
With the help of support from slider Revolution this is not much of a problem... the actual problem starts now:

Each page hast a clip that should randomly be selected when chaning pages (or reload page). Now the Revo slider is placed in elementor/rife pro with a short code and now I'm looking for a solution that will randomly pick a short code from a list of short codes (one for each of the 20 clips)

Any idea? Anything would help!

Thanks so much for you valuable support!
Pascal

Comments

  • edited April 9 Posts: 384
    Hi Pascal

    To be honest, I did not find a shortcode with this functionality, but maybe you will consider creating one slider with slides in random order?
    Take a look at this tutorial: https://www.snellmitchell.co/knowledgebase-help-support/slider-revolution-5-randomise-slides/ and let me know what you think?

    P.S I found something like this: https://www.themepunch.com/faq/show-a-random-slider-on-any-given-page/ but it looks quite old and I'm not sure if it still works ;)

    With kind regards,
    Daniel
    Post edited by Daniel on
    Lead Graphic Designer
  • Posts: 199
    Hi Daniel


    Thanks for those infos. The issue is that I need to have a two slides slider in order to add the final frame when the clip stops. So I cannot use singles slides within one slider... I actually really need to have randome sliders (each containing two slides)... I have forwarded the second tut (their own :smile: ) to them punch.. let's see what they think?

    The fist tutorial is "weird"? As their already is an option to randomize slides (in one slider) within Revo under geneeral Settings of the slider ("Shuffle" function)...

    Let's see how to solve this issue
    And thanks once more for all the help!
    Pascal
  • Posts: 199
    Hi Daniel
    So, Themepunch confirmed that the php script is working.. here is what they sent me:

    -----
    You need to edit the page.php file of your theme and than you need to add below php code in the page.php file. Page.php file can be found under theme’s root folder

    // get a list of all available sliders
    $my_sliders = new RevSlider();

    // grab the "alias" names of the sliders
    $my_slider_array = $my_sliders->getAllSliderAliases();

    // randomize magic
    $my_slider_keys = array_keys($my_slider_array);
    $my_random_slider_alias = $my_slider_array[$my_slider_keys[rand(0, count($my_slider_keys) - 1)]];

    // add the random slider to the page
    putRevSlider($my_random_slider_alias);

    ----

    Now I'm reaching out to you guys again to make sure I implement that the correct way. Should I use a plugin for the php code (for instance: https://wordpress.org/plugins/my-custom-functions/) And how do I make sure the Sliders will be on the pages (I placed them using short codes so far)?

    Thanks a lot
    Pascal
  • AirAir
    Posts: 9,868
    Hello :-)

    To be honest I don't know why they gave you such a solution when you are planning to use it as part of the Elementor content.

    I think(not sure) I could convert this code to a shortcode, if this code really works, but it requires some time for testing that I don't have today.

    I could try on Monday, however, Mondays are always overloaded with requests from the weekend ;-)

    With kind regards.

  • Posts: 199
    Hey Air

    Thank you so much.. any help is really appreciated! I will finish setting up the test site for this task and will give you access to that if this can help...

    You rock!
    Pascal
  • Posts: 199
    Hello Air

    So I have once more contacted theme punch because of my issue (since it's a Slider Rev issue in the first place) and they are trying to solve my issue.. in case they fail I woud kindly ask for your help again.. but hopefully I won't have to bother you anymore for this?

    As I'm building a new site there will be enough other questions related to rife anyways :wink:
    Thanks, Pascal
  • AirAir
    Posts: 9,868
    Hey :-)

    Thanks for the update on this!

    If anything, please let me know :-)

    With kind regards.
  • Posts: 199
    Hi Air

    We're getting there.. not the best solution yet.. but I think they will manage!
    Of course I already have a new question based on the landing page OneLander II:

    Now the "Tab" in the cener is all the way visible and when scrolling start it get smaller > Is it possible the other way around.. "tab" is small" and only while scrolling the whole "tab" is visible?

    And: Can I change the shape of the "tab"?

    You can see what I'm working on here: https://zauberduo.flyart.com

    Thanks, Pascal
  • Posts: 384
    Hi Pascal

    I assume that the "Tab" is the shield under the logo, right? ;)
    You can change how much the logo should hide here: https://nimb.ws/F2rBgO
    About changing the shape, we don't have more shapes but let me know what you want to put there and I'll consult with .Air :)

    Best,
    Daniel
    Lead Graphic Designer
  • Posts: 199
    Hi Daniel

    Yes.. the shield :wink:
    I probalby didn't explain myself correctly. I'd like to invert the way the shield interacts. I have made quick comps in photoshop to explain better (see attachments).
    I'll look into what shape would fit the best and I'll contact you again for that "issue".

    Thanks a lot, Pascal
    shield-rife-onelander-top-of-page.jpg
    1088 x 1078 - 118K
    shield-rife-onelander-scrolling-sticky-header.jpg
    1088 x 1078 - 120K
    shield-rife-onelander-no-scrolling-sticky-header.jpg
    1088 x 1078 - 116K
  • AirAir
    Posts: 9,868
    Hey Pascal :-)

    Thanks for the screens!

    Sorry but such a thing is not possible. Relaying on scroll event is not an option in the current mobile world.

    My personal opinion is that such behavior would also be very annoying, as it would additionally cover content while scrolling when the user usually scan what they see.

    With kind regards.
  • Posts: 199
    Hey Air

    Thanks for our feedback! I'll come back when (or if) I could try a new shape ;)
  • Posts: 199
    Hey Air

    Well.. Themepunch implemented the php into page.php but didn't manage the create shortcode out of if :neutral: So I'm coming back hoping you can help.. now the random function works fine but it places a clip on the top of every page .. so I cannot decide which page should have it or where to place it on a certain page.. are you still up for helping me?
    Thanks a lot, Pascal
  • AirAir
    Posts: 9,868
    Sure Pascal :-)

    Please send me temporary* access to your WordPress and FTP. Send it here on the forum via private message(click on my nick, in top-right corner you will find option "Message").

    By sending access to WordPress I mean:
    -create a new ADMIN account with a fake e-mail
    -set some password to this account
    -send me created login and password

    *temporary - please delete this account after I am done, for your safety!
  • Posts: 199
    Hi Air

    Thanks a million! You can use the accesses you already have as I didn't change them (since it's a test site anyways)
  • AirAir
    Posts: 9,868
    Hey :-)

    Your shortcode is called [flyart_random_revo].

    I have removed the code from page.php and moved it to child theme functions.php.

    Please check it:-)

    With kind regards.
  • Posts: 199
    Hey Air!
    Once more: you are the man! Fantastic! Thank you so much!
    Pascal
  • Posts: 199
    Hi Air

    I wanted to work onthe site but I cannot work on the page you did as working example in Elementor anymore.. also when I try to place the shortcode into another page and save in elementor I get a server error...
    Could you have a look? Thank you
    Pascal
  • Posts: 199
    and now I got this message:

    Fatal error: Uncaught Error: Call to undefined function putRevSlider() in /home/flyartes/www/zauberduo.flyart.com/wp-content/themes/rife-pro-child-theme/functions.php:39 Stack trace: #0 /home/flyartes/www/zauberduo.flyart.com/wp-includes/shortcodes.php(325): a13rife_random_revo('', '', 'flyart_random_r...') #1 [internal function]: do_shortcode_tag(Array) #2 /home/flyartes/www/zauberduo.flyart.com/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(a13fe\\...', 'do_shortcode_ta...', '[flyart_random_...') #3 /home/flyartes/www/zauberduo.flyart.com/wp-includes/class-wp-hook.php(286): do_shortcode('[flyart_random_...') #4 /home/flyartes/www/zauberduo.flyart.com/wp-includes/plugin.php(208): WP_Hook->apply_filters('[flyart_random_...', Array) #5 /home/flyartes/www/zauberduo.flyart.com/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1532): apply_filters('the_content', '[flyart_random_...') #6 /home/flyartes/www/zauberduo.flyart.com/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php in /home/flyartes/www/zauberduo.flyart.com/wp-content/themes/rife-pro-child-theme/functions.php on line 39
  • AirAir
    Posts: 9,868
    Yes, because I started debugging. I will reply soon
  • Posts: 199
    THANKS!
  • AirAir
    Posts: 9,868
    Hello :-)

    It looks that Elementor tries to execute shortcode before RevoSlider is loaded. I have added protection for this. However, it seems that now you will not be able to see shortcode working in Elementor, but it will work on the front-end.

    Have a great weekend!

    With kind regards.
  • Posts: 199
    That was super quick.. thanks a lot.. and no problem if I don't see it working in elementor!
    Have a great weekend also!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!