236 posts
    Has sold $10,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 1+ items on Envato Market Sells items exclusively on Envato Market
+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
    Has been part of the Envato Community for over 4 years Has referred 1+ members Has sold $40,000+ on Envato Market Has collected 100+ items on Envato Market
+2 more
KarmaThemes says

What do you want to do with it?!

1625 posts Building the Web.
    Has referred 50+ members Has sold $250,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 50+ items on Envato Market
+7 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
    Has been part of the Envato Community for over 3 years Sells items exclusively on Envato Market Located in United States
christopherjon says

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

236 posts
    Has sold $10,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 1+ items on Envato Market Sells items exclusively on Envato Market
+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
    Has been part of the Envato Community for over 4 years Has referred 1+ members Has sold $40,000+ on Envato Market Has collected 100+ items on Envato Market
+2 more
KarmaThemes says

May somebody finally tell me what this does? :D

236 posts
    Has sold $10,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 1+ items on Envato Market Sells items exclusively on Envato Market
+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
    Has been part of the Envato Community for over 4 years Has referred 1+ members Has sold $40,000+ on Envato Market Has collected 100+ items on Envato Market
+2 more
KarmaThemes says

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

236 posts
    Has sold $10,000+ on Envato Market Has been a beta tester for an Envato feature Has collected 1+ items on Envato Market Sells items exclusively on Envato Market
+1 more
GradaStudio says

the difference between the two is same as

echo and return in PHP .

hope this makes sense :)

1141 posts
    Has been part of the Envato Community for over 4 years Has referred 1+ members Has sold $40,000+ on Envato Market Has collected 100+ items on Envato Market
+2 more
KarmaThemes says

Ah! Thanks!

by
by
by
by
by
by