List view widget and featured image
Hi,
I found this code in your tutorial. It adds the featured image thumbnail to the List view widget:
// Here we hook into our template action - just before the date tag, which is the first item in the container.
add_action(
'tribe_template_after_include:events/v2/widgets/widget-events-list/event/date-tag'
,
'my_action_add_event_featured_image'
,
15,
3
);
// Here we utilize the hook variables to get our event, find the image, and echo the thumbnail.
function
my_action_add_event_featured_image(
$file
,
$name
,
$template
) {
// Get the event for reference - we'll need it.
$event
=
$template
->get(
'event'
);
$link
= sprintf(
'<a href="https://wordpress.org/support/topic/list-view-widget-and-featured-image/%1$s">%2$s</a>'
,
get_the_post_thumbnail_url(
$event
),
get_the_post_thumbnail(
$event
,
'thumbnail'
,
array
(
'class'
=>
'alignleft'
) )
);
echo
$link
;
}
It is great. Unfortunately, I am not experienced in php. Can this code be modified in such a way that the full featured image is shown (not the thumbnail)? I perfer to use this code and not the custom template way.
Thanks !
Frans van Ittersum
The page I need help with: [log in to see the link]
مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد
منبع: انجمن وردپرس