Title: Certain WP functions not working
Last modified: April 4, 2017

---

# Certain WP functions not working

 *  [wrip](https://wordpress.org/support/users/wrip/)
 * (@wrip)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/)
 * My original theme has functions such as `do_shortcode()` and `get_template_part()`
   hard-coded into the theme files. Looks like these functions are not working when
   I directly add them inside the AMP template files. I also tried your ‘Custom 
   AMP Theme’ from Github. Still has the same issue. Is there a way to make these
   WP functions work within the AMP templates?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [wrip](https://wordpress.org/support/users/wrip/)
 * (@wrip)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/#post-8989336)
 * Looks like it’s working. I was trying this inside the wrong template file.
 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/#post-8989470)
 * Hey [@wrip](https://wordpress.org/support/users/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](https://wordpress.org/support/users/wrip/)
 * (@wrip)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/#post-8989866)
 * Hi [@ampforwp](https://wordpress.org/support/users/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?
 *  Plugin Contributor [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * (@ampforwp)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/#post-8994451)
 * Hey [@wrip](https://wordpress.org/support/users/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

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Certain WP functions not working’ is closed to new replies.

 * ![](https://ps.w.org/accelerated-mobile-pages/assets/icon-256x256.png?rev=1693616)
 * [AMP for WP - Accelerated Mobile Pages](https://wordpress.org/plugins/accelerated-mobile-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accelerated-mobile-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accelerated-mobile-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accelerated-mobile-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [ampforwp](https://wordpress.org/support/users/ampforwp/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/certain-wp-functions-not-working/#post-8994451)
 * Status: not resolved