Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Random Image from Folder

  • omp-generatepress

    Hi,

    I like to show a random banner from a folder and link it to the external website.
    I can do this with the plugin https://wordpress.org/plugins/hot-random-image/

    Right now the code to show the banner is:

    <?php
    $country = get_field('folder');
    $url = get_field('url');
    echo do_shortcode('[randomimage path="wp-content/uploads/advertise/' . $folder . '" link="' . $url . '" ]');
    ?>

    Is there any possibility to do the same with Elements, so that I don´t need to use the plugin?

  • Hi there,

    The Elements can only hook the content to the page, but they are unable to perform logic like fetching random images.

    It looks like the plugin you linked also provides a block to display random images, and you can use that in the banner Element.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.