Forum Replies Created
-
AuthorPosts
-
The site is: https://devdep.phoenixgate.ca/ – this is our development site. I’ve hidden the search icon on mobile, FYI. I can unhide it as needed.
I don’t know what to tell you, but it’s not working on the home page. I took a screenshot that you can see here (https://ufile.io/8a6af) what it returns and the code is below. What am I missing? I added the code to the end of the section for output, but it’s pulling the home page’s own content with HTML/tags.
if (!empty($entries)) { global $post; $default_id = $post->ID; $output .= "<div class='av-upcoming-events ".$meta['el_class']."'>"; foreach($entries as $entry) { $class = "av-upcoming-event-entry"; $image = get_the_post_thumbnail($entry->ID, 'square', array( 'class' => 'av-upcoming-event-image' )); $class .= !empty($image) ? " av-upcoming-event-with-image" : " av-upcoming-event-without-image"; $title = get_the_title($entry->ID); $link = get_permalink($entry->ID); $post->ID = $entry->ID; //temp set of the post id so that tribe fetches the correct price symbol $price = tribe_get_cost( $entry->ID, true ); $venue = tribe_get_venue( $entry->ID ); $post->ID = $default_id; $output .= "<a href='{$link}' class='{$class}'>"; if($image) $output .= $image; $output .= "<span class='av-upcoming-event-data'>"; $output .= "<h4 class='av-upcoming-event-title'>{$title}</h4>"; $output .= "<span class='av-upcoming-event-meta'>"; $output .= "<span class='av-upcoming-event-schedule'>".tribe_events_event_schedule_details($entry)."</span>"; $output .= apply_filters('avf_upcoming_event_extra_data', "", $entry); $output .= "</span>"; $output .= "</span>"; $output .= "</a>"; $excerpt = !empty(get_the_excerpt($entry->ID)) ? get_the_excerpt($entry->ID) : get_the_content($entry->ID); if($excerpt) $output .= "<span class='av-upcoming-event-excerpt'>{$excerpt}</span>"; }
I’ve tried every iteration of that, and all it seems to do is display the excerpt or content for the page it’s on, not for the event you’re trying to pull, creating a loop within a loop, but showing the HTML code for it.
Is there another way to do this? I can’t quite imagine why there’s no default option to include the excerpt.
For the record, I had even found older code that a moderator had suggested, which is below, but it does not work in the current version. I also tried $entry->the_excerpt, and $entry->the_content;
$excerpt = $entry->post_excerpt; $output .= "<span class='av-upcoming-event-excerpt'>{$excerpt}</span>";
- This reply was modified 7 years, 11 months ago by pgsmarketing.
I realize it’s the weekend, but does anyone have ideas about this? It seems like it should be easy but literally nothing works. I’ve tried get_the_content, the_content, and even the_excerpt.
I should add that I don’t want to waste anyone’s time making them login and such, but just need a tip on why the code to show an excerpt here doesn’t seem to be working no matter what I try. If it’s really easier I can provide admin access but I’m assuming I’m fairly close to the right answer here.
Circling back on this and hopefully someone can still help.
The file is in config-templatebuilder > avia-shortcodes > events_upcoming.php and I’m trying to add the excerpt within the display at around line 155/156 or so within this code:
if($image) $output .= $image; $output .= "<span class='av-upcoming-event-data'>"; $output .= "<h4 class='av-upcoming-event-title'>{$title}</h4>"; $output .= "<span class='av-upcoming-event-meta'>"; $output .= "<span class='av-upcoming-event-schedule'>".tribe_events_event_schedule_details($entry)."</span>"; $output .= apply_filters('avf_upcoming_event_extra_data', "", $entry); $output .= "</span>"; $output .= "</span>"; $output .= "</a>";
I’ve tried using get_the_excerpt as well as this code below. Any tips would be appreciated as nothing seems to work to pull the excerpt or a portion of the_content.
$output .= $content = apply_filters( 'the_excerpt', get_the_excerpt() );
-
AuthorPosts