Home Forums Backend Issues (wp-admin) Need to generate A List of Image Sliders as Post Objects


Need to generate A List of Image Sliders as Post Objects

  • Hi there

    I have several custom post types with several custom fields. One of the fields is a text field which is used to generate shortcode to display an image slider (Using the RoyalSlider plugin)

    This solution works fine however I’d like to find a way to return a list of available sliders instead of manually entering the shortcode. I’d like to return the slider titles. Is there a way to use ACF to achieve this?

    At present I am doing this:

    $shortcode = get_field('image_slider'); echo do_shortcode ($shortcode);

    The Field ‘image_slider’ is a text field containing the shortcode e.g. [new_royalslider id=”1″].

    RoyalSlider has a method which returns the Slider title:

    global $wpdb; $prefix = $wpdb->prefix; $sliders = $wpdb->get_results("SELECT id,name FROM " . $prefix . "new_royalsliders ORDER BY id"); foreach ($sliders as $slider) { $name = $slider->name; $id = $slider->id; } echo $name;

    But I don’t know how to use this with ACF to generate this as a post object for example or the gallery add on?

    Any help would be awesome

    Many thanks:
    WP: 3.9
    ACF: 4.3.8

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.