236 posts
  • Author Level 5
  • Beta Tester
  • Collector Level 1
  • Exclusive Author
+1 more
GradaStudio
says

hi guys is there any way to get the dynamic sidebar instead of directly echoing it.

i want something like get_dynamic_sidebar(‘sidebar’)

1141 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 4
+3 more
KarmaThemes
says

What do you want to do with it?!

1744 posts Building the Web.
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
  • Beta Tester
+10 more
ZoomIt
says
if(!function_exists('get_dynamic_sidebar'){
function get_dynamic_sidebar($index = 1)
{
$sidebar_contents = "";
ob_start();
dynamic_sidebar($index);
$sidebar_contents = ob_get_clean();
return $sidebar_contents;
}
}
438 posts
  • 4 Years of Membership
  • Exclusive Author
  • United States
christopherjon
says

There are a lot of way to do it. Just depends on what you are trying to accomplish.

236 posts
  • Author Level 5
  • Beta Tester
  • Collector Level 1
  • Exclusive Author
+1 more
GradaStudio
says
ZoomIt said
if(!function_exists('get_dynamic_sidebar'){
function get_dynamic_sidebar($index = 1)
{
$sidebar_contents = "";
ob_start();
dynamic_sidebar($index);
$sidebar_contents = ob_get_clean();
return $sidebar_contents;
}
}

thanks a lot man it works :)

1141 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 4
+3 more
KarmaThemes
says

May somebody finally tell me what this does? :D

236 posts
  • Author Level 5
  • Beta Tester
  • Collector Level 1
  • Exclusive Author
+1 more
GradaStudio
says

@karmathemes

when we use dynamic_sidebar(‘sidebar’) function it simply display the sidebar. however i wanted to rerturn the content of sidebar instead of displaying it so zoomit has given the perfect solution for that.

1141 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 4
+3 more
KarmaThemes
says

Hm I’m not sure if I understand the difference but thanks!

236 posts
  • Author Level 5
  • Beta Tester
  • Collector Level 1
  • Exclusive Author
+1 more
GradaStudio
says

the difference between the two is same as

echo and return in PHP .

hope this makes sense :)

1141 posts
  • 5 Years of Membership
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 4
+3 more
KarmaThemes
says

Ah! Thanks!

by
by
by
by
by
by