Thread Starter
wrip
(@wrip)
Looks like it’s working. I was trying this inside the wrong template file.
Hey @wrip
Thank you so much for using our plugin.
Great to hear you have resolved the issue by yourself.
Let me know if you have any questions regarding AMP, i will be happier to help you.
Thread Starter
wrip
(@wrip)
Hi @ampforwp
Yes I do have another question. The output of get_template_part() function gives me some page/post urls that don’t have ‘/amp’ appended. How do I convert those urls into amp urls?
Hey @wrip
thank you so much for using our plugin.
get_template_part() will not work as expected sometimes with amp and I suggest you to use the code like this to add more
// Related Posts
function ampforwp_add_element_related_posts( $meta_parts ) {
$meta_parts[] = 'ampforwp-related-posts';
return $meta_parts;
}
add_filter( 'amp_post_template_file', 'ampforwp_design_element_related_posts', 10, 3 );
function ampforwp_design_element_related_posts( $file, $type, $post ) {
if ( 'ampforwp-related-posts' === $type ) {
$file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/related-posts.php';
}
return $file;
}
also if you can share me that piece of code you are adding and that’s not working as expected. So that i can suggest you something