Nested shortcodes support

General questions on how to do things using Photonic

Nested shortcodes support

Postby nextpress » 10 Apr 2012, 12:10

Hi, thank you for your wonderful plugin. I have tweaked some of the functions in your plugin however I can not find the way to use another shortcode within the default shortcode.
Example:
[gallery type='flickr' user_id='[shortcode1]' view='photos' tag_mode='any' sort='date-posted-desc' per_page='[shortcode2]' ]
I try to input variable from other plugin here but nothing shown in my post.
Could you show me the way to make this kind of shortcode works.
Thanks.
nextpress
 
Posts: 2
Joined: 10 Apr 2012, 12:05

Re: Nested shortcodes support

Postby nextpress » 10 Apr 2012, 21:39

I found a work around this problem which is within the photonic.php file
search for this:
Code: Select all
      $attr = array_merge(array(
         // Specially for Photonic
         'type' => $photonic_default_gallery_type,  //default, flickr, picasa
         'style' => 'default',   //default, strip-below, strip-above, strip-right, strip-left, no-strip, launch
         'id'         => $post->ID,

change to:
Code: Select all
      $attr = array_merge(array(
         // Specially for Photonic
         'type' => $photonic_default_gallery_type,  //default, flickr, picasa
         'style' => 'default',   //default, strip-below, strip-above, strip-right, strip-left, no-strip, launch
         'user_id' => do_shortcode('[shortcode1]'),
         'id'         => $post->ID,

It is not upgrade safe so if you can provide some other options that would be wonderful.
nextpress
 
Posts: 2
Joined: 10 Apr 2012, 12:05

Re: Nested shortcodes support

Postby sayontan » 12 Apr 2012, 19:44

Probably an easier approach is this:
  1. Open photonic.php
  2. Go to the function modify_gallery
  3. Locate this code near the top of the function:
    Code: Select all
          $attr = array_merge(array(
             // Specially for Photonic
             'type' => $photonic_default_gallery_type,  //default, flickr, picasa
             'style' => 'default',   //default, strip-below, strip-above, strip-right, strip-left, no-strip, launch
             'id'         => $post->ID,
          ), $attr);
  4. Add one line below it:
    Code: Select all
          $attr = array_map('do_shortcode', $attr);

Let me know if this meets your requirements. I can include that in the core.
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas


Return to Support Requests

Who is online

Users browsing this forum: No registered users and 1 guest