• Resolved candell

    (@candell)


    I have sliders in various pages added using the gutenberg block, all works great.

    I’m creating a single cpt template which will need a slider. It makes sense to use this slider as it’s already installed. Is this possible? I notice the included files only load on pages with a slider set up, do you have a method to call the files within a template?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Virgildia

    (@virgildia)

    Hey @candell , if you’re using PHP templates (classic theme), you can render the slider block directly in your template. Try do_blocks() or render_block(). You must render the real block comment (<!-- wp:... -->), not just copy the slider’s HTML output.

    If you’re using FSE (a block theme), the cleaner approach is to create or edit the template in the Site Editor and insert the slider as a pattern or regular block there.

    Overall, the block is designed to be used within post content. There hasn’t been specific testing or official support for adding it directly inside PHP templates. If you choose to implement it that way, you will need to experiment and see what works best in your setup. Feel free to share your findings with the community. It could help others in the same situation.

    Thread Starter candell

    (@candell)

    Thanks @virgildia for the reply.

    The slider will be to show recent posts in my single-post.php template, I was hoping you had a function for templates providing similar options to the block.

    Plugin Author Virgildia

    (@virgildia)

    I see. The Carousel Block plugin doesn’t expose a template function API. The block is primarily built for the editor. You can however include it in a FSE template (a block theme, not PHP)

    • This reply was modified 1 month, 2 weeks ago by Virgildia.
    Thread Starter candell

    (@candell)

    No worries, thanks for the replies.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.