Clicky

  1. Home
  2. Developer Docs
  3. Displaying “Custom AMP editor” Content through php code

Displaying “Custom AMP editor” Content through php code

All the content added in “Custom AMP editor” will be saved in post meta.

If you want to fetch the data from Custom AMP editor then use below the function

get_post_meta() is a function and in that we’re passing 3 parameter

If you want to know more about get post meta then you can check this official documentation

https://developer.wordpress.org/reference/functions/get_post_meta/

Syntax:

get_post_meta( int $post_id, string $key = ”, bool $single = false )

get_post_meta(get_the_ID,’ampforwp_custom_content_editor’, true ) ;

Parameters:

  • get_the_ID: By using this parameter you can retrieve the ID of the current item in the WordPress Loop
  • ampforwp_custom_content_editor: By using this key you can fetch the data saved in Custom AMP Content
  • true: By default this value is false

This is the example of Code

That’s it for this tutorial!

We hope it helped you. If you have any feedback or questions, then please share them in the comments section below..


Ask your Questions Directly!
If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!
Updated on June 10, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment