WordPress.org

Support

Support » Plugins and Hacks » WP Calendar » [Plugin: WP Calendar] Maybe you can add this tip in FAQ (how to hide event widget)

[Plugin: WP Calendar] Maybe you can add this tip in FAQ (how to hide event widget)

  • I needed to hide the widget if there was no event to have no “ugly” empty block in my website.

    It’s not so difficult :

    1. Install and activate extension “Widget Logic Visual”

    2. Edit function.php in wordpress install directory and add at the end :

    function has_calendar_events() {
        if ( count( fse_get_events(array()) ) > 0 ) {   // test to see if there are some events to display
            return true;
        } else {
            return false;
        }
    }

    3. Then use “Edit Limitation” in the widget options. Select “Using Conditional Tag Code ( Advanced )”.
    Fill conditional code with value :
    has_calendar_events()
    And tick “activate code”.

    http://wordpress.org/extend/plugins/wp-calendar/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Calendar] Maybe you can add this tip in FAQ (how to hide event widget)’ is closed to new replies.
Skip to toolbar