Nested shortcodes

blamingas

New member
(sorry, I've posted this thread into a wrong section. Re-posting it here).
Hello.
I'm using WebRotate's Wordpress plugin and I'm going to use expanded mode of shortcode:
[wr360expand name="view4" browserfs="false" config="url-of-the-viewer-config.xml"]thumbnail or text[/wr360expand]

And instead of adding just a picture for thumbnail, in functions.php of Wordpress theme I created my custom shortcode [spin360_icon] (with pre-adjusted css) which I want to add to "thumbnail or text" of your shortcode. However Wordpress doesn't allow to use shortcode inside of shortcode, it requires to create so called "nested shortcode" which means that I have to include my shortcode [spin360_icon] into the php code of your one. In plugin folder I've found the file class-wr360-shortcodes.php with wr360expand shortcode - what should I change in there to include my [spin360_icon] code so Wordpress would allow me to use it as a thumbnail inside of your shortcode [wr360expand]?
Thanks.

Kind regards,
Oleksiy Kardash
 

WebSupport

Active member
Hi Oleksiy,

We're not familiar with nested shortcodes in WordPress unfortunately, but you can modify the content (i.e "thumbnail or text" as per your example) as needed in PHP in class-wr360-shortcodes.php by changing the $content parameter:

Code:
    public function add_expand_shortcode_hanlder($atts, $content)
    {
    ...
        $replace .= $content;
    ...
 

blamingas

New member
Thank you. After changing $content parameter my custom shortcode is correctly placed in "thumbnail or text" area and desired image is showing up (my custom shortcode returns a div with background image and css parameters). However it doen't work as a link to my 360 expanded viewer. It just shows as a regular non-clickable image, while the original content "thumbnail or text" was a link before my changes.
Could you please suggest me how can I fix it? Thanks
---------
$replace .= $content; // this line I replaced with the next code:

$spin360_icon_shortcode = do_shortcode( '[spin360_icon]' );
$replace .= $spin360_icon_shortcode;
 

WebSupport

Active member
Hi! We would need to see it in action to advise. Can you possibly share a link to the page with the issue? You may send it to support at webrotate360 dot com or paste here.
 

blamingas

New member
WebSupport said:
Hi! We would need to see it in action to advise. Can you possibly share a link to the page with the issue? You may send it to support at webrotate360 dot com or paste here.
Sure, here is the link: https://hochunoshu.com.ua/product/%d1%82%d0%b5%d1%81%d1%82%d0%be%d0%b2%d1%8b%d0%b9-%d1%82%d0%be%d0%b2%d0%b0%d1%80/
you can see the test icon "360" on the bottom of the page under the product-gallery box.
Thanks
 

WebSupport

Active member
It doesn't seem like your code is rendering yet. May be it's some sort of page cache you have there?

2021-01-21_8-47-34.png

You can simply add this instead of rendering another shortcode (at least to test this):

$replace .= '<div class="spin360-icon"></div>';
 
Top