Events widget title change to image
-
I’m using the widget that displays a list of events in my sidebar. I have a specific look for my website that requires me to replace the title of the widget with an image.
Instead of using text, I’m using an image with the title in the alt tag. However, pasting the image src html within the title field doesn’t work.
Does any one know how I can replace the title text with an image?
To see what my sidebar style looks like, go here:
http://www.hardwareretailing.com/test/latest-news/
-
Unless I’m mistaken, it looks like you’re adding the arrow image via CSS. In which case you should be able to apply the same styles to the EM widgets too.
Hi,
another way is to use [events_list] shortcode in text widgets – http://wordpress.org/plugins/shortcodes-in-sidebar-widgets/
Thank you for showing me that plugin, angelo! This might be a quick-fix for the sake of launching on time, but it’d be nice if I could use the Event Manager widget.
Caimin: I didn’t put those arrows in. That’s automatically part of the theme I downloaded. It looks like it places those arrows on every li tag on the site. I tried to paste the title image within the format box, but that made the title image appear above every event in the widget (…oops, should’ve seen that coming).
I tweaked the em-events.php to use echo “image coding inserted here” right before the ul tag, but the image never appeared.
I could probably add the image to the h4 tag of the widget as a background, but I want to avoid this option.
I figured it out!
When I attempted to tweak the em-events.php yesterday, I also tried to add an else condition to the echo $args[‘before_widget’], but I must’ve not coded it correctly. Originally I added else { echo “image stuff”; } by itself.
Today, I changed it to include the before_/after_title arguments, and it works great! As long as the title field is empty in the widget, it will display the image.
echo $args['before_widget']; if( !empty($instance['title']) ){ echo $args['before_title']; echo apply_filters('widget_title',$instance['title'], $instance, $this->id_base); echo $args['after_title']; } else { echo $args['before_title']; echo '<img src="http://www.hardwareretailing.com/test/wp-content/uploads/2013/06/sidebar-industry-calender.jpg" alt="Industry Calendar" title="Industry Calendar" /><br />'; echo $args['after_title']; }
Thank you for your help!
just marking this as resolved.
thanks for the update.
- The topic ‘Events widget title change to image’ is closed to new replies.