Is it possible to display featured image on the single shedule page instead of the speakers image

  1. Home
  2. Docs
  3. Vertoh
  4. Frequently Asked Question...
  5. Is it possible to display featured image on the single shedule page instead of the speakers image

Is it possible to display featured image on the single shedule page instead of the speakers image

Yes. It’s possible. Please do the following:

1) Don’t forget to back-up the file prior to any changes.

2) Open wp-content/themes/vertoh/event-framework/helpers/cpt/sessions.php

3) Around line number 210, you can find:

array_push($ret[‘sessions’], array(
‘post_title’ => get_the_title(),
‘post_excerpt’ => get_the_excerpt(),
‘url’ => get_permalink(get_the_ID()),
‘time’ => $time,
‘end_time’ => $end_time,
‘date’ => $session_date,
‘location’ => $location ? $location->name : ”,
‘color’ => $track ? EF_Taxonomy_Helper::ef_get_term_meta(‘session-track-metas’, $track, ‘session_track_color’) : ”,
‘tracks’ => $tracks,
‘speakers’ => $speakers
));

4) Please change this to:

array_push($ret[‘sessions’], array(
‘post_title’ => get_the_title(),
‘post_excerpt’ => get_the_excerpt(),
‘url’ => get_permalink(get_the_ID()),
‘time’ => $time,
‘end_time’ => $end_time,
‘date’ => $session_date,
‘location’ => $location ? $location->name : ”,
‘color’ => $track ? EF_Taxonomy_Helper::ef_get_term_meta(‘session-track-metas’, $track, ‘session_track_color’) : ”,
‘tracks’ => $tracks,
‘featured_image’ => get_the_post_thumbnail( get_the_ID()),
‘speakers’ => $speakers
));

5) This is a core file. Please note this change and redo the change when you upgrade the theme.

6) Please dequeue the parent theme schedule.js script and enqueue the new schedule.js script.

7) For this, add the following code to functions.php on child theme. (wp-content/themes/vertoh-child/functions.php):

<?php
add_action(‘wp_print_scripts’,’theme_dequeue_myscript’);
function theme_dequeue_myscript() {
wp_dequeue_script(‘vertoh-schedule’ );

}

add_action( ‘wp_enqueue_scripts’, ‘vertoh_child_script_override’ );
function vertoh_child_script_override()
{
if (get_page_template_slug() == ‘schedule.php’) {
wp_enqueue_script( ‘vertoh-child-schedule’, get_stylesheet_directory_uri() . ‘/js/schedule.js’, array( ‘jquery’ ) );
}
}

?>
8) Copy wp-content/themes/vertoh/js/schedule.js to wp-content/themes/vertoh-child/js/schedule.js

9) Around line number 69, you can find:

html += ‘<div class=”schedule-single”>
<div class=”col-sm-7″>
<div class=”date”>
<span class=”time”><i class=”fa fa-clock-o”></i>’ + session.time + ‘ – ‘ + session.end_time + ‘</span>
<span class=”map”><i class=”fa fa-map-marker”></i>’ + session.location + ‘</span>
</div>
<h3 class=”title”><a href=”‘ + session.url + ‘”>’ + session.post_title + ‘</a></h3>
<div class=”content”>’ + session.post_excerpt + ‘</div>
‘ + tracks + ‘
</div>
<div class=”col-sm-5 images’ + (session.speakers.length > 2 ? ‘ many-images’ : ”) + ‘”>
‘ + speakers + ‘
<a href=”‘ + session.url + ‘” class=”c-dark button pull-right”>’ + data.strings[‘more_info’] + ‘
<span class=”sessions-icon fa-stack”>
<i class=”fa fa-circle-thin fa-stack-2x”></i>
<i class=”fa fa-plus fa-stack-1x”></i>
</span>
</a>
</div>
</div>’;

10) Change this to:

html += ‘<div class=”schedule-single”>
<div class=”col-sm-7″>
<div class=”date”>
<span class=”time”><i class=”fa fa-clock-o”></i>’ + session.time + ‘ – ‘ + session.end_time + ‘</span>
<span class=”map”><i class=”fa fa-map-marker”></i>’ + session.location + ‘</span>
</div>
<h3 class=”title”><a href=”‘ + session.url + ‘”>’ + session.post_title + ‘</a></h3>
<div class=”content”>’ + session.post_excerpt + ‘</div>
‘ + tracks + ‘
</div> ‘;
html += ‘<div class=”col-sm-5 images “>
‘ + session.featured_image + ‘
<a href=”‘ + session.url + ‘” class=”c-dark button pull-right”>’ + data.strings[‘more_info’] + ‘
<span class=”sessions-icon fa-stack”>
<i class=”fa fa-circle-thin fa-stack-2x”></i>
<i class=”fa fa-plus fa-stack-1x”></i>
</span>
</a>
</div> ‘;

html += ‘</div>’;

11) Save the files.

Was this article helpful to you? Yes 1 No