Support

Home Forums Event Espresso Premium Widget Text Format

Widget Text Format

Posted: July 24, 2013 at 1:23 pm


goneilbell

July 24, 2013 at 1:23 pm

Hi

I send a message earlier about how text was appearing in the EE Widget – it didn’t match the format of other text blocks in the side bar. I was told that the widget uses normal paragraphs but I would like it to match the format and spacing of my other Widgets, without effecting the main text content.

Do you know how I can do this? I can do basic stuff but I’m not a programmer so please go easy on me!

Thanks


Josh

  • Support Staff

July 24, 2013 at 3:15 pm

Hi there,

This was something that was covered in the old forums:

https://eventespresso.com/forums/2012/02/ee-widget-unordered-list-items-not-paragraphs/

Hope the information there helps!


goneilbell

July 25, 2013 at 1:50 am

Ok Josh

Thanks for coming back to me, I’ve tried that and it still looks the same.

In summary I altered the widget.php file in wp-content>plugins>event-espress>templates I swapped ALL of the <p> for

I put a infront of every single <p>

I changed every </p> for a

And I put:

/* Before widget (defined by themes). */
echo $before_widget;
echo ”;

AFTER before_widget

and the following BEFORE the after_widget

/* After widget (defined by themes). */
echo ”;
echo $after_widget;

and it looks like it did before – do you know where I am going wrong? In the old thread you said that this would be added to EE 3.2 – I’m guessing this didn’t happen?

I can’t be the only person this affects!

Thanks


Dean

July 25, 2013 at 4:12 am

Hi,

Not sure what you have done with the code, as our code syntax highlighter seems to have gone a bit wonky.

Copy the widget.php file to the wp-content/uploads/espresso/templates directory and replace its contents with this http://pastebin.com/yA1dXiD5

Note that page will expire in one week.


goneilbell

July 25, 2013 at 4:51 am

Thanks Dean

It’s working now!

Ged


goneilbell

July 25, 2013 at 5:25 am

Hi Dean

I have another error, which seems to be caused by that widget.php

After I have put that widget.php file in place, the EE Widget looks like it should however, when I update pages or posts the whole page goes white – I can move back in the browser and the action will not have been saved but if I click update or publish the page just goes white.

I have deleted the widget.php and the problem goes away. I upload and I get the same problem.

Do you know what could be causing this?

Thanks

Ged


Dean

July 25, 2013 at 5:43 am

What version of Event espresso are you using? It’s possible that because I used the latest version of the template it could be affecting it. Or the code wasnt added correctly.


goneilbell

July 25, 2013 at 6:01 am

Hi

I’m using 3.1.33.3.P (which I upgraded to before I had bought this years licence if that makes a difference?).

This is the code I pasted:

<?php
if (!class_exists(‘Event_Espresso_Widget’)) {

class Event_Espresso_Widget extends WP_Widget {

function Event_Espresso_Widget() {

/* Widget settings. */

$widget_options = array(‘classname’ => ‘events’, ‘description’ => __(‘A widget to display your upcoming events.’, ‘event_espresso’));
/* Widget control settings. */

$control_options = array(‘width’ => 300, ‘height’ => 350, ‘id_base’ => ‘events-widget’);
/* Create the widget. */

$this->WP_Widget(‘events-widget’, __(‘Event Espresso Upcoming Events Widget’, ‘event_espresso’), $widget_options, $control_options);
}

function widget($args, $instance) {

extract($args);

global $wpdb, $org_options;
/* Our variables from the widget settings. */

$title = apply_filters(‘widget_title’, $instance[‘title’]);

/* Before widget (defined by themes). */
echo $before_widget;
echo ”;

/* Display the widget title if one was input (before and after defined by themes). */
if ($title)
echo $before_title . $title . $after_title;

if ($instance[‘category_name’] != ”) {
$type = ‘category’;
}

$event_page_id = $org_options[‘event_page_id’];

$show_expired = $instance[‘show_expired’] == ‘false’ ? ” AND (e.start_date >= ‘” . date(‘Y-m-d’) . “‘ OR e.event_status = ‘O’ OR e.registration_end >= ‘” . date(‘Y-m-d’) . “‘) ” : ”;
$show_secondary = $instance[‘show_secondary’] == ‘false’ ? ” AND e.event_status != ‘S’ ” : ”;
$show_deleted = $instance[‘show_deleted’] == ‘false’ ? ” AND e.event_status != ‘D’ ” : ”;
$show_recurrence = $instance[‘show_recurrence’] == ‘false’ ? ” AND e.recurrence_id = ‘0’ ” : ”;
$limit = $instance[‘limit’] > 0 ? ” LIMIT 0,” . $instance[‘limit’] . ” ” : ‘ LIMIT 0,5 ‘;
//$order_by = $order_by != ‘NULL’? ” ORDER BY “. $order_by .” ASC ” : ” ORDER BY date(start_date), id ASC “;
$order_by = ” ORDER BY date(start_date), id ASC “;

if (isset($type) && $type == ‘category’) {
$sql = “SELECT e.*, c.category_name, c.category_name, c.category_desc, ese.start_time FROM ” . EVENTS_CATEGORY_TABLE . ” c “;
$sql .= ” JOIN ” . EVENTS_CATEGORY_REL_TABLE . ” r ON r.cat_id = c.id “;
$sql .= ” JOIN ” . EVENTS_DETAIL_TABLE . ” e ON e.id = r.event_id “;
$sql .= ” LEFT JOIN ” . EVENTS_START_END_TABLE . ” ese ON ese.event_id = e.id “;
$sql .= ” WHERE c.id = ‘” . $instance[‘category_name’] . “‘ “;
$sql .= ” AND e.is_active = ‘Y’ “;
} else {
$sql = “SELECT e.*, ese.start_time FROM ” . EVENTS_DETAIL_TABLE . ” e “;
$sql .= ” LEFT JOIN ” . EVENTS_START_END_TABLE . ” ese ON ese.event_id = e.id “;
$sql .= ” WHERE e.is_active = ‘Y’ “;
}
$sql .= $show_expired;
$sql .= $show_secondary;
$sql .= $show_deleted;
$sql .= $show_recurrence;
$sql .= ” GROUP BY e.id “;
$sql .= $order_by;
$sql .= $limit;

$events = $wpdb->get_results($sql);

//print_r($events);
//event_espresso_get_event_details($sql);
foreach ($events as $event) {
$event->id = $event->id;
$event->event_name = isset($event->event_name) ? $event->event_name : ”;
$event->start_date = isset($event->start_date) ? $event->start_date : ”;
$event->category_name = isset($event->category_name) ? $event->category_name : ”;
$event->category_desc = isset($event->category_desc) ? $event->category_desc : ”;
$event->externalURL = isset($event->externalURL) ? $event->externalURL : ”;
$registration_url = $event->externalURL != ” ? $event->externalURL : espresso_reg_url($event->id);

$all_meta = array(
‘is_active’ => $event->is_active,
‘event_status’ => $event->event_status,
‘event_address’ => $event->address,
‘event_address2’ => $event->address2,
‘registration_startT’ => $event->registration_startT,
‘registration_start’ => $event->registration_start,
‘registration_endT’ => $event->registration_endT,
‘registration_end’ => $event->registration_end,
‘start_date’ => event_date_display($event->start_date, get_option(‘date_format’)),
‘start_time’ => event_date_display($event->start_time, get_option(‘time_format’)),
‘end_date’ => event_date_display($event->end_date, get_option(‘date_format’)),
);

//Here we can create messages based on the event status

$status = event_espresso_get_is_active($event->id, $all_meta);
//Print out the array of event status options
//print_r (event_espresso_get_is_active($event->id));

$status_display = ‘ – ‘ . $status[‘display_custom’];
$status_display_ongoing = $status[‘status’] == ‘ONGOING’ ? ‘ – ‘ . $status[‘display_custom’] : ”;
$status_display_deleted = $status[‘status’] == ‘DELETED’ ? ‘ – ‘ . $status[‘display_custom’] : ”;
$status_display_secondary = $status[‘status’] == ‘SECONDARY’ ? ‘ – ‘ . $status[‘display_custom’] : ”; //Waitlist event
$status_display_reg_closed = $status[‘status’] == ‘REGISTRATION_CLOSED’ ? ‘ – ‘ . $status[‘display_custom’] : ”;
$status_display_not_open = $status[‘status’] == ‘REGISTRATION_NOT_OPEN’ ? ‘ – ‘ . $status[‘display_custom’] : ”;
$status_display_open = $status[‘status’] == ‘REGISTRATION_OPEN’ ? ‘ – ‘ . $status[‘display_custom’] : ”;

//You can also display a custom message. For example, this is a custom registration not open message:
$status_display_custom_closed = $status[‘status’] == ‘REGISTRATION_CLOSED’ ? ‘ – <span class=”espresso_closed”>’ . __(‘Regsitration is closed’, ‘event_espresso’) . ‘</span>’ : ”;

//End

if (!is_user_logged_in() && defined(‘EVENTS_MEMBER_REL_TABLE’) && !empty($member_only) && $member_only == ‘Y’) {
//Display a message if the user is not logged in.
//_e(‘Member Only Event. Please ‘,’event_espresso’) . event_espresso_user_login_link() . ‘.’;
} else {
//Serve up the event list
//As of version 3.0.17 the event list details have been moved to event_list_display.php
switch ($status[‘status’]) {
case ‘NOT_ACTIVE’:
//Don’t show the event if any of the above are true
break;

default:
?>
“><?php echo stripslashes_deep($event->event_name) ?> – <?php echo event_date_display($event->start_date) ?>
<?php /* These are custom messages that can be displayed based on the event status. Just comment the one you want to use. */ ?>
<?php //echo $status_display; //Turn this on to display the overall status of the event. ?>
<?php //echo $status_display_ongoing; //Turn this on to display the ongoing message. ?>
<?php //echo $status_display_deleted; //Turn this on to display the deleted message. ?>
<?php //echo $status_display_secondary; //Turn this on to display the waitlist message. ?>
<?php //echo $status_display_reg_closed; //Turn this on to display the secondary message. ?>
<?php //echo $status_display_not_open; //Turn this on to display the secondary message. ?>
<?php //echo $status_display_open; //Turn this on to display the secondary message. ?>
<?php //echo $status_display_custom_closed; //Turn this on to display the secondary message. ?>

<?php
break;
}
}
}
/* After widget (defined by themes). */
echo ”;
echo $after_widget;
}

/* Update the widget settings. */

function update($new_instance, $old_instance) {
$instance = $old_instance;

/* Strip tags for title and name to remove HTML (important for text inputs). */
$instance[‘title’] = strip_tags($new_instance[‘title’]);
$instance[‘category_name’] = $new_instance[‘category_name’];
$instance[‘show_expired’] = $new_instance[‘show_expired’];
$instance[‘show_secondary’] = $new_instance[‘show_secondary’];
$instance[‘show_deleted’] = $new_instance[‘show_deleted’];
$instance[‘show_recurrence’] = $new_instance[‘show_recurrence’];
$instance[‘limit’] = $new_instance[‘limit’];

return $instance;
}

/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
* */
function form($instance) {

/* Set up some default widget settings. */

$defaults = array(‘title’ => __(‘Upcoming Events’, ‘event_espresso’), ‘category_name’ => ”, ‘show_expired’ => ‘false’, ‘show_secondary’ => ‘false’, ‘show_deleted’ => ‘false’, ‘show_recurrence’ => ‘false’);

$instance = wp_parse_args((array) $instance, $defaults);

$values = array(
array(‘id’ => ‘false’, ‘text’ => __(‘No’, ‘event_espresso’)),
array(‘id’ => ‘true’, ‘text’ => __(‘Yes’, ‘event_espresso’)));
//select_input(‘allow_multiple’, $values, $allow_multiple);
?>

<!– Widget Title: Text Input –>

<p>
<label for=”<?php echo $this->get_field_id(‘title’); ?>”>
<?php _e(‘Title:’, ‘event_espresso’); ?>
</label>
<input id=”<?php echo $this->get_field_id(‘title’); ?>” name=”<?php echo $this->get_field_name(‘title’); ?>” value=”<?php echo $instance[‘title’]; ?>” size=”20″ type=”text” />
</p>
<p> <label for=”<?php echo $this->get_field_id(‘category_name’); ?>”>
<?php _e(‘Event Category:’, ‘event_espresso’); ?>
</label><br />
<?php echo espresso_db_dropdown(‘id’, ‘category_name’, EVENTS_CATEGORY_TABLE, ‘id’, $instance[‘category_name’], $strMethod = “desc”, $this->get_field_name(‘category_name’)) ?></p>
<p>
<label for=”<?php echo $this->get_field_id(‘limit’); ?>”>
<?php _e(‘Limit:’, ‘event_espresso’); ?>
</label>
<input id=”<?php echo $this->get_field_id(‘limit’); ?>” name=”<?php echo $this->get_field_name(‘limit’); ?>” value=”<?php echo $instance[‘limit’]; ?>” size=”3″ type=”text” />
</p>
<p><?php _e(‘Optional Settings:’, ‘event_espresso’); ?></p>
<p><?php _e(‘Show Expired Events?’, ‘event_espresso’); ?> <?php echo select_input($this->get_field_name(‘show_expired’), $values, $instance[‘show_expired’]); ?></p>
<p><?php _e(‘Show Waitlist Events?’, ‘event_espresso’); ?> <?php echo select_input($this->get_field_name(‘show_secondary’), $values, $instance[‘show_secondary’]); ?></p>
<p><?php _e(‘Show Deleted Events?’, ‘event_espresso’); ?> <?php echo select_input($this->get_field_name(‘show_deleted’), $values, $instance[‘show_deleted’]); ?></p>
<p><?php _e(‘Show Recurring Events?’, ‘event_espresso’); ?> <?php echo select_input($this->get_field_name(‘show_recurrence’), $values, $instance[‘show_recurrence’]); ?></p>

<?php
}

}

}


Dean

July 25, 2013 at 6:32 am

It’s similar but what you pasted here doesnt have the code I added in the pastebin. I would make sure the widget.php is copied to the wp-content/uploads/espresso/templates directory and then edit that file and remove its contents. Then copy the pastebin code and paste it into the empty widgets.php file and save.


goneilbell

July 25, 2013 at 8:06 am

Not quite sure what happened there.

I deleted the old file, created a new blank one.

Pasted the text and Robert is indeed your fathers brother.

Cheers for helping me out!

Ged


Dean

July 25, 2013 at 9:17 am

No problem!

The support post ‘Widget Text Format’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso