• Hi,
    I am trying to add some extra data to the AMP single page template.
    My code for the regular page is:

    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
    $first_tag = $tags[0]->term_id;
    $args=array(
    'tag__in' => array($first_tag),
    'post__not_in' => array($post->ID),
    'posts_per_page'=>10,
    'caller_get_posts'=>1
    );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php $metadesc = get_post_meta( $post->ID, 'description', true ); echo $metadesc;?><div class="date"><?php the_time('Y'); ?></div></a>
    </li>
    <?php
    endwhile;

    However, $post->ID returns empty in the AMP template. How do I adapt my code to make things work? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Modifying template’ is closed to new replies.