I’m trying to make latest comments list with amp-list. Here is my code
<amp-list
layout="fixed-height"
width="auto"
height="100vh"
items="."
src="/wp-json/wp/v2/comments?per_page=50"
load-more="auto"
id="live-comments-list"
>
<template type="amp-mustache">
<div class="sidebar-live-comments__wrapper">
<div class="sidebar-live-comments__body">
<?php $comment = '{{#content}}<code>rendered</code>{{/content}}';
$authorID = '{{author}}';
?>
<i class="fas fa-user"></i>
<span class="sidebar-live-comments__author">{{author_name}}</span>
<div class="sidebar-live-comments__content"><?php echo $comment; ?></div>
<a class="sidebar-live-comments__link" href="{{link}}">Reply</a>
</div>
</div>
</template>
<div placeholder>
<div class="sidebar-live-comments__placeholder-item"></div>
</div>
<div fallback>Failed to load data.</div>
</amp-list>
As making custom REST API endpoint is a little bit tricky, I just want to use wordpress core functions such as get_permalink()
, get_the_author_url()
, etc. with amp-mustache template tags (for ex: $id = '{{id}}'; get_permalink($id);
)
But for some reason wp functions doesn’t work
(also no luck with intval() and strval() and google search )
Is there any way to make it work?
Thanks
]]>How can I fix this issue?
]]>I started to face the following error:
The extension ‘amp-mustache’ is referenced at version ‘0.1’ which is a deprecated version. Please use a more recent version of this extension. This may become an error in the future.
First detected: 7/28/18
Status: Warning
If I manually change the code (note the from 1 to 2) FROM:
<script async custom-template=”amp-mustache” src=”https://cdn.ampproject.org/v0/amp-mustache-0.1.js”></script>
TO
<script async custom-template=”amp-mustache” src=”https://cdn.ampproject.org/v0/amp-mustache-0.2.js”></script>
I don’t have the issue anymore.
Can you please check to update this?
All my pages show this warning and my customer is concerned.
Thank you.
]]>Pls check.
Thanks
]]>The tag ‘amp-mustache extension .js script’ appears more than once in the document. This will soon be an error.
Indeed the source code of the page shows the code appearing twice.
https://prnt.sc/hk65uf
<!doctype html> <html amp lang="en-US"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"> <script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script> <script custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js" async></script> <meta name="amp-google-client-id-api" content="googleanalytics">
How to fix this?
]]>