• Hello,

    I have a temaplte where i use some plugin offering a widget features. Now i use this widget once in sidebar an once directly included into the template via “the_widget();”.

    Now i want to modify them. The sidebar widget should just look different than the widget i included directly. It’s more than just some toying around with css.

    Is there any way like conditional tags to detect if the wigdet is placed within the sidebar or not?
    How can i differ if its in sidebar or directly in code?

    Thank you i advance, Chris

Viewing 1 replies (of 1 total)
  • From your template call a different function in your plugin.

    So in your plugin you will have:

    function widget() {
        return real_function( true );
    }
    function widget_from_template() {
        return real_function( false );
    }
    function real_function(from_widget) {
    //your widget code
     ...
    }

Viewing 1 replies (of 1 total)
  • The topic ‘How can i detect if a widget is in sidebar or included in the template’ is closed to new replies.