plugins - Is there a way to get dynamic data into a Slider Revolution slide from a PHP script?

admin2025-06-04  3

I have a PHP class that I'm using to make requests to an external API for data like view/follower counts.

I want to show a couple pieces of that data on my homepage in a Slider Revolution slide.

There aren't any default layers that I can put in to execute PHP code or anything like that that I have found. I know that there is a custom JS area, where I could potentially make an AJAX request to a script that instantiates the class and returns data from it.

But I'm not sure how I would implement that data within the slide.

I have a PHP class that I'm using to make requests to an external API for data like view/follower counts.

I want to show a couple pieces of that data on my homepage in a Slider Revolution slide.

There aren't any default layers that I can put in to execute PHP code or anything like that that I have found. I know that there is a custom JS area, where I could potentially make an AJAX request to a script that instantiates the class and returns data from it.

But I'm not sure how I would implement that data within the slide.

Share Improve this question edited Jan 10, 2019 at 22:50 Timothy Fisher asked Jan 10, 2019 at 22:38 Timothy FisherTimothy Fisher 2181 silver badge11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Was easier than I thought, didn't know that you could execute shortcodes in the text/html block.

function twitch_api_client_views_shortcode() {
    $twitch = twitch_api_client();
    return $twitch->getViewCount();
}
add_shortcode( 'twitch-views', 'twitch_api_client_views_shortcode' );

And then [twitch-views] in Slider Revolution text/html layer.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749024068a315712.html

最新回复(0)