Thread tagged as: Question, Events

Events and Page Attributes / meta


I'm following along with your tutorial on “Using Page Attributes to add Facebook Open Graph Tags and Twitter Cards”.

Where I'm getting stuck is on the Events app, where nothing at all is showing in the head of my site. The handy 'perch_blog_post_meta(perch_get('s'));' is great. Is there nothing for Events that is equivalent? Do I have to rewrite templates that draw upon the events data myself?

<?php perch_layout('global-header');

# get the post
$event = perch_events_custom(array(
      'filter'        => 'eventSlug',
      'match'         => 'eq',
      'value'         => perch_get('s'),
      'skip-template' => 'true',
      'return-html'   => 'true',
// echo '<pre>';
//   var_dump($event);
// echo '</pre>';
# set up the variables
$domain        = 'https://'.$_SERVER["HTTP_HOST"];
$title       = $event['0']['eventTitle'];
$longdescription = strip_tags($event['0']['eventDescHTML']);
$description = substr($longdescription,0,157) . '...'; // Shorten the event HTML
if (isset($event[0]['fbimage'])) {
    $fbimage = $event[0]['fbimage'];
} else {
    $fbimage = $domain . '/perch/resources/' . $event['0']['image']['sizes']['w1200h630c1']['path'];
# use the variables in the array value
    'description'    => $description,
    'og_description' => $description,
    'og_title'       => $title,
    'og_type'        => 'article',
    'sharing_image'  => $fbimage,
    'og_author'      => '',


If I add 'hello' as a line of raw test into templates/pages/attributes/default.html nothing appears in the page source markup on blog or events, however it does in regular pages.

I can confirm that extra code for $fbimage works fine in generating the url.

If I var_dump $event, I see all the relevant information.

Can you please offer any advice on how to get the events meta to kick into gear?


Adam Menczykowski

Adam Menczykowski 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

All perch_blog_post_meta() does is call perch_blog_custom() with a different default template. The concept is simply displaying your event through a template that outputs a subset of fields.

OK So I'll simply knock up a template to that effect for Events then, thanks.

I see that the blog uses


So I'll re-use that when constructing the events version.