Title: Modifying template
Last modified: December 18, 2017

---

# Modifying template

 *  [superkot](https://wordpress.org/support/users/superkot/)
 * (@superkot)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/modifying-template-4/)
 * 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)

 *  Plugin Author [Mohammed Kaludi](https://wordpress.org/support/users/mohammed_kaludi/)
 * (@mohammed_kaludi)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/modifying-template-4/#post-9795172)
 * Are you using the method you using to customize the file?
 * In other words, how are you targeting the file?
 *  Thread Starter [superkot](https://wordpress.org/support/users/superkot/)
 * (@superkot)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/modifying-template-4/#post-9795398)
 * I am using one of the free themes from your site as a basis and modifying _single.
   php_ in there.
 *  Plugin Author [Mohammed Kaludi](https://wordpress.org/support/users/mohammed_kaludi/)
 * (@mohammed_kaludi)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/modifying-template-4/#post-9805538)
 * I understand now. That theme is built with blAMP theme framework [https://ampforwp.com/amp-theme-framework/](https://ampforwp.com/amp-theme-framework/)
 * You are basically trying to add a loop, so you need to AMP loop [https://ampforwp.com/tutorials/article/loop/](https://ampforwp.com/tutorials/article/loop/)
 * That should solve the problem for you.

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

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

 * ![](https://ps.w.org/accelerated-mobile-pages/assets/icon-256x256.png?rev=1693616)
 * [AMP for WP - Accelerated Mobile Pages](https://wordpress.org/plugins/accelerated-mobile-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accelerated-mobile-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accelerated-mobile-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Mohammed Kaludi](https://wordpress.org/support/users/mohammed_kaludi/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/modifying-template-4/#post-9805538)
 * Status: not resolved