Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Slider Shortcode Width and Height

Open splendidbob opened this issue 11 years ago • 2 comments

Hi, I was hoping to be able to insert a slider shortcode into a text option area which displays somewhere else in the theme (other than the page / post where it was created, e.g. above the content).

But the framework seems to handle slider shortcodes rather strangely, that is, when the shortcodes are called (via do_shortcode()) they render in various ways, depending on which part of the site they are called. So for example:

1)A 1300*300 slider is created in a post. - [slider fw_shortcode_id="3"] 2)The shortcode from this is pasted into an option ('opt_header_extra_editor') 3)The contents of which are displayed above the content on every template: echo do_shortcode( fw_get_db_settings_option('opt_header_extra_editor'))

The results of this are peculiar:

1)On the post where the shortcode was created, the shortcode renders as expected. 2)On the site homepage, the shortcode renders, but defaults to 300*200 size images 3)On any other posts and pages, the shortcode errors.

'Notice: Undefined index: slider in wp-content/plugins/unyson/framework/extensions/shortcodes/extensions/page-builder/extensions/editor-shortcodes/class-fw-extension-editor-shortcodes.php on line 182'

Can you explain what is causing this? Is there any way to do what I want it to do?

Many thanks.

splendidbob avatar May 15 '15 21:05 splendidbob

@splendidbob If you want to call a slider from code ,please read our documentation.

fw_ext('slider')->render_slider(10, array(
    'width'  => 300,
    'height' => 200
));

where first parameter is post_id of the slider , second parameter is an array of crop dimension of the photo.

llemurya avatar May 29 '15 06:05 llemurya

Hi, Thanks for replying.

Unfortunately this isn't really going to help as hardcoding the slider in the template isn't something I can expect the user to do.

The problem is that the shortcode won't work anywhere else other than the post on which it is created. Which is really strange (and significantly cuts down on its usefulness).

I just assumed the shortcodes outputted from the page builder would work in the standard way as regular shortcodes (that is, they would work anywhere in the theme) - using parameters to pass the variables. Instead they work in some other non standard way.

splendidbob avatar Jun 03 '15 03:06 splendidbob