Site logo

Archived topic

Different Revolution sliders for different pages?

3 replies · Started by Pavla on May 4, 2020

Viewing posts 1–4 of 4

Hi! I need different revolution sliders for different pages, now i have them directly in the content which i need to change to have more control over the element ( e.g. I need to add a breadcrumb after the slider which i now cant do, because it is placed directly in the content)
How can I achieve to be able to add a slider (e.g. over shortcode) in the page/entry edit screen?

thank you!

Hi there,

you could do this:

1. Create a Custom Field
https://wordpress.org/support/article/custom-fields/

1.1 This will contain your slider shortcode eg. [slider-shortcode]

2. Create a GP Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
2.1 Add this code to your hook:

<?php
$sliderShortcode = get_post_meta( get_the_id(), 'custom_field_key', true );
if ( $sliderShortcode ) {
    echo do_shortcode( $sliderShortcode );
}
?>

2.2 Select the before_content hook and Check Execute PHP.
2.3 Set your Display Rules.

Note: replace custom_field_key in code above with the name you gave your custom field

amazing thats perfect! thank you!

Awesome - glad to be of help

This archived topic is closed to new replies.