Forum

Thread tagged as: Question, Meta, Blog
Drew McLellan

Drew McLellan 2638 points
Perch Support

That's it! I can't seem to get it to work though

Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like you're missing this:

# get the post
    $post = perch_blog_custom(array(
          'filter'        => 'postSlug',
          'match'         => 'eq',
          'value'         => perch_get('s'),
          'skip-template' => true,
          'return-html'   => true,
      ));

Okay, so I've got this:

<?php include('admin/runtime.php');?>

<!DOCTYPE html>
<html lang="">
   <?php
    $title = perch_blog_post_field(perch_get('s'), 'postTitle', true);
    perch_layout('global.header', array(
      'title'=>$title
    ));
?>
   <body>
<?php include('includes/analyticstracking.php'); ?>
      <?php include('includes/navigation.php');?>

            <?php 
       $post = perch_blog_custom(array(
          'filter'        => 'postSlug',
          'match'         => 'eq',
          'value'         => perch_get('s'),
          'skip-template' => true,
          'return-html'   => true,
      ));

       # set up the variables
    $title       = $post['0']['postTitle'];
    $description = strip_tags($post['0']['excerpt']);
    if (isset($post[0]['fbimage'])) {
        $fbimage = $post[0]['fbimage'];
    } else {
        $fbimage = '';
    }

    # use the variables in the array value
    perch_page_attributes_extend(array(
        'description'    => $description,
        'og_description' => $description,
        'og_title'       => $title,
        'og_type'        => 'article',
        'sharing_image'  => $fbimage,
        'og_author'      => 'https://www.facebook.com/JohnMarkFilms',
    ));
        echo $post['html'];

       ?>

And still nothing

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have this somewhere lower in the process?

perch_page_attributes(array(        
      'template' => 'default.html'    
    ));

Even with it, I got nothing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You need it.

<?php 
       $post = perch_blog_custom(array(
          'filter'        => 'postSlug',
          'match'         => 'eq',
          'value'         => perch_get('s'),
          'skip-template' => true,
          'return-html'   => true,
      ));

       # set up the variables
    $title       = $post['0']['postTitle'];
    $description = strip_tags($post['0']['excerpt']);
    if (isset($post[0]['fbimage'])) {
        $fbimage = $post[0]['fbimage'];
    } else {
        $fbimage = '';
    }

    # use the variables in the array value
    perch_page_attributes_extend(array(
        'description'    => $description,
        'og_description' => $description,
        'og_title'       => $title,
        'og_type'        => 'article',
        'sharing_image'  => $fbimage,
        'og_author'      => 'https://www.facebook.com/JohnMarkFilms',
    ));
        echo $post['html'];
       perch_page_attributes(array(        
      'template' => 'default.html'    
    ));
       ?>

Right, I have this and nothing

Drew McLellan

Drew McLellan 2638 points
Perch Support

So you're outputting the meta tags underneath your post. Is that what you intend? Are you looking for them there or in the head of the page?

In the head

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so if you look further down the page after the post, are they there?

No there's not

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure I know how to help in that case.