WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Widget bullet fix (7 posts)

  1. finnj
    Member
    Posted 1 year ago #

    Hi Authors,

    a small enhancement request:

    I am using events manager with the suffusion theme, and I need to remove the bullets added by the <ul> <li> code of the widget.

    The best way I have been able to fix this, is to add a simple div statement to the em_events.php (widget folder), and then use custom include css (from suffusin theme) to remove the bullets:
    .em_event_widget ul li {background-image:none !important;}

    The change it looks like this: Before, After

    The code change to em_events.php is below, and I hope you can add this (or something similar we can hook into - I believe it is easy and low risk :) :

    $events = EM_Events::get(apply_filters('em_widget_events_get_args',$instance));
    		//Hook enabling css formatting of eventlist widget
    		echo "<div class='em_event_widget'>";
    		echo "
    <ul>";
    		$li_wrap = !preg_match('/^
    <li>/i', trim($instance['format']));
    		if ( count($events) > 0 ){
    			foreach($events as $event){
    				if( $li_wrap ){
    					echo '</li>
    <li>'. $event->output($instance['format']) .'</li>
    ';
    				}else{
    					echo $event->output($instance['format']);
    				}
    			}
    		}else{
    			echo '
    <li>'.$instance['no_events_text'].'</li>
    ';
    		}
    		if ( !empty($instance['all_events']) ){
    			$events_link = (!empty($instance['all_events_text'])) ? em_get_link($instance['all_events_text']) : em_get_link(__('all events','dbem'));
    			echo '<li class="all-events-link">'.$events_link.'';
    		}
    		echo "</ul>
    ";
    		//End hook enabling css formatting of eventlist widget
    		echo "</div>";
    	    echo $args['after_widget'];

    Then I use this code to build the widget list:

    <table>
    <tr>
    <td>
    <div style=					"border: 1px solid #c2c2c2;
    							border-top-color: #ffffff;
    							border-radius: 5px;
    							overflow: hidden;
    							color: #525252;
    							float: left;
    							font-weight: normal;
    							background-color: #f9f9f9;
    							background-repeat: no-repeat;
    							line-height: 1.2em;
    							margin: 0px 0px;
    							text-align: center;
    							width: 3.5em;
    							font-size: 11px;
    							">
    <div style=					"background: #617284;
    							text-transform: uppercase;
    							color: #ffffff;
    							">
    	#D</div>
    <div style=					"padding: 0.2em 0 0.1em !important;
    							font-size: 12px;
    							font-weight: bold;
    							">
    	#j</div>
    <div style="		line-height: 1.2em;">
    	#M</div>
    </div>
    </td>
    <td style="padding=1px 5px">#_EVENTLINK@#_LOCATIONNAME
    </br>
    </td>
    </tr>
    </table>

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    have you tried to hook into em_widget_events_get_args filter instead?

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

  3. finnj
    Member
    Posted 1 year ago #

    My explanation was probably not good enough...

    It is only in the event widget I want to remove the bullets created by <ul>

    I would like Marcus to add the following code into the em_events.php (widget folder) so I can avoid php changes :

    //Hook enabling css formatting of eventlist widget
    		echo "<div class='em_event_widget'>";

    To me it seems like a simple and no-risk change, but if the same can done in a smarter way it is fine by me :).

    Having the <div> to hook into will enable users to change the styling for the entire widget, not only withing the <ul> scope.

    if it can be done without php, and without this change, I would like a suggestion for that.
    Marcus answered:

    currently there's no way to prevent this from being a list

    in this post:
    http://wordpress.org/support/topic/widget-bullets?replies=3

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    The above wouldn't work because many people are already assuming it comes as a UL list. Will change this in the future when time permits so you can use your own header/footer html.

    What you can do now is just copy the widget php file, and rename the widget so you create your own widget. Then, edit at will and include that one instead of our one.

    You'd want to edit the class name, this line:
    parent::WP_Widget(false, $name = 'Events', $widget_ops);

    and the last line in that file so you can differentiate between ours and yours

  5. finnj
    Member
    Posted 1 year ago #

    Hi Marcus,

    I am not asking you to remove the UL, and with the proposed solution it should work as previously unless you add the changes to your theme css. I can see that it could be difficult to see what i suggested:

    Add the DIV statement just before the UL statement:

    echo "<div class='em_event_widget'>";
    echo "<ul>";

    and a close of the DIV just after the close of UL

    Unless you add em_event_widget reference in you css files, UL should behave as the DIV statement wasn't there, and as before.

    The name em_event_widget, can be any unique name, it is just my suggestion.

    the DIV statement enables users (me) to remove the bullets by adding this to the custom includes in my theme (Suffusion):
    .em_event_widget ul li {background-image:none !important;}

    As far as I know I would still have to modify php files each time you release an upgrade, if I made a copy of the widget, as it needs to be loaded through the plugin.

    Apart for this change request i love your plugin, and I especially like the posibilities to modify output you have implemented, it is just the bullets in the widget I have been unable to get rid of.

    Thanks for looking into this.

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    i see what you mean now. however this should already be possible, WP adds classes to surrounding WP widgets, specific to each widget type. can't you use that? try checking out your source code with e.g. Chrome's element inspector (right click on your widget > Inspect Element).

  7. finnj
    Member
    Posted 1 year ago #

    Hi Marcus,

    I never got around to try this, but after your new version I had to :)

    You were right, bullets can be removed using the following css:

    #em_widget-3 ul li {
    padding-left:1px !important;
    background-image:none !important;
    }

    Why it is em_widget-3 I dont know, but it works :)

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.