0

I am trying to call dynamic_sidebar from a plugin page. Whenever I do so, it returns a white page! Any idea why?

What I am trying to do is to save the total sidebar output in a transient. I can get the sidebar output in a variable from the theme files, using this codes:

ob_start();
dynamic_sidebar('name');
$sidebar= ob_get_contents();
ob_end_clean();

I can get the data in $sidebar and save it in a transient. But whenever I use this code from a plugin, the plugin admin page returns white screen. It happens whenever I call dynamic_sidebar in my plugin codes, doesn't matter what's before or after.

Does anyone know why? Or any solution please?

  • What debug info do you get? – Pieter Goosen Jul 21 '14 at 4:22
  • @PieterGoosen My bad. I should have debug before asking a question. It was a syntax error. I was getting sidebar name from a function, which was not returning correctly. Thanks – тнє Sufi Jul 21 '14 at 13:48
  • 1
    My pleasure. A tip, always enable debug if you develop. Will help you a lot in future – Pieter Goosen Jul 21 '14 at 13:58
0

it's a little difficult to debug something when no errors are being displayed. i'd first check your php error logs, which normally appear in ....\logs\php_error.log or ....\logs\apache_erroe.log depending on your php.ini settings.

chances of getting an immediate answer to your question will be difficult unless you can provide the actual error that's popping up.

  • Thanks, I have solved it by debugging. It was a syntax error. – тнє Sufi Jul 21 '14 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.