Skip Navigation

[Resolved] Use types custom field with google amp (accelerated mobile pages)

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 22 replies, has 2 voices.

Last updated by Nicholas 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#919562

I am trying this but it doesn't seem to work

<?php $my_post_meta = get_post_meta($post->ID, 'wpcf-post-youtube-video-id', true); ?>

<?php if ( ! empty ( $my_post_meta ) ) { ?>
<amp-img alt="A view of the sea"
src="hidden link;?php echo get_post_meta( $post->ID, 'wpcf-post-youtube-video-id', true); ?>/hqdefault.jpg"
width="900"
height="675"
layout="responsive">
</amp-img>
<?php } ?>

#919572

I also tried this

  <?php if(has_post_thumbnail()) { ?>
	<?php $this->load_parts( array( 'featured-image' ) ); ?>
  <?php } else { ?>
    <amp-img alt="A view of the sea"
      src="<em><u>hidden link</u></em>;?php echo get_post_meta( $post->ID, 'wpcf-post-youtube-video-id', true); ?>/hqdefault.jpg"
      width="900"
      height="675"
      layout="responsive">
    </amp-img>
<?php } ?>

It didn't work

#919929

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I dont think it's a Toolset issue. As when we try to retrieve the data its returning the correct youtube video ID. I suggest you should contact AMP support and check with them what is the correct way to display it using PHP template.

#922246

Would you mind helping me out with this since you already have access to my site?
I am sure you can detect the problem fairly quickly.

thanks and regards,
nick

#922320

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sorry but I think I did not explain well. The thing is that this is not a matter or access details but about how AMP is integrated.

As you can already see that the values from custom fields are retrieved successfully and also works at some point but not with the amp shortcodes. We follow the exact syntax as you already know but still its not working. You should consult AMP support for that as this is something that is beyond the scope of our support policy to debug why third party shortcode not working.

#922330

Thanks for taking a look into this. I am sure it's just something very simple we missed.

#922383

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I do not find any issue related to Toolset here. Sorry. I checked but nothing I see I missed here.

Feel free to close the ticket here.

#922424

Thank you.