WordPress.org

Ready to get started?Download WordPress

Forums

WP Calendar
Maybe you can add this tip in FAQ (how to hide event widget) (5 posts)

  1. amagnier
    Member
    Posted 1 year ago #

    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/

  2. dsg257
    Member
    Posted 1 year ago #

    nice very useful thanks

  3. faebu
    Member
    Plugin Author

    Posted 1 year ago #

    Thank. I just added your solution to the FAQ!

  4. dsg257
    Member
    Posted 1 year ago #

    was using Widget Logic Visual with the above code but the plugin is incompatable with wordpress 3.5 widget areas wont open

  5. dsg257
    Member
    Posted 1 year ago #

    use widget logic instead works
    widget logic

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic