Using amp-mustache template tags inside wordpress functions
-
Hey there!
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
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Using amp-mustache template tags inside wordpress functions’ is closed to new replies.