We Want to Change the Date Under Each Event to the First Sentence of the Event Description. Is it possible?

  1. Home
  2. Docs
  3. Januas
  4. Frequently Asked Question...
  5. We Want to Change the Date Under Each Event to the First Sentence of the Event Description. Is it possible?

We Want to Change the Date Under Each Event to the First Sentence of the Event Description. Is it possible?

You can display the first sentence of the event by making small changes in the source file. Here you have the steps to achieve it.

1. Don´t forget to take a backup of the files that you are editing, prior to any updates.

2. Login to your admin dashboard.

3. Navigate to Appearance->Editor, select the Main Index Template (index.php) on the right side.

4. You will find a code like below:

<p class=”byline vcard”><?php _e(‘When:’, ‘januas’); ?> <time class=”updated” datetime=”<?php the_time(‘c’); ?>”><?php echo !empty($event_date) ? date(get_option(‘date_format’), get_post_meta($post->ID, ‘januas_eventdata_startdate’, true)) : ”; ?></time>
</p>

5. Replace this with the following code:

<p class=”byline vcard”> <?php
$content =get_the_content();
$pos = strpos($content, “.”);
echo $words = substr($content, 0, $pos);
?></p>

6. Update the file.

Was this article helpful to you? Yes 1 No