0

I was wondering if there is an easy solution to add some php "if" code when my website tries to show the widgets and if it has $_SESSION I set on homepage (based on the source of which they came) not to show one of them?

1 Answer 1

0

The easiest way to do this is via dynamic_sidebar()

<?php
if ($a == $b)  // Your $_SESSION stuff
  dynamic_sidebar( 'Right Sidebar' );
?>

Any widgets contained in the "Right Sidebar" will now be loaded based on your condition. You should use this with register_sidebar()

http://codex.wordpress.org/Function_Reference/dynamic_sidebar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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