Here is the complete list of all our hooks including their functionalities:
| Actions Hooks | Description |
| amp_post_template_head | It is used to add extra things in Head section of AMP which will come in handy if you want to add extra metas, JS of AMP components, etc.., |
| amp_post_template_css | It is used to add extra CSS to your AMP pages |
| ampforwp_body_beginning | It is executed right after the beginning of Body tag which can be very useful to add things like Analytics. |
| ampforwp_after_header | It is executed right after the header section of AMP |
| below_the_header_design_1 [ Design-1 only ] | It is executed right after the header section of AMP |
| amp_post_template_above_footer | It executes right before the footer.php |
| amp_post_template_footer | It executes after the footer and just before the end of the body tag. |
| pre_amp_render_post | This hook will only work in the AMP environment. |
| amp_experiment_meta | With the help of this hook, you can add additional meta tags |
| amp_meta | With the help of this hook, you can add meta tags |
| ampforwp_after_amp_menu | With the help of this hook, you can add additional meta tags in the header section |
| amp_before_footer | With the help of this hook, you can add additional meta tags in the footer section |
| amp_footer_link | With the help of this hook, you can add a link in the footer section |
| amp_sidebar_start | With the help of this hook, you can add additional information at the beginning of the sidebar |
| amp_sidebar_end | With the help of this hook, you can add additional information at the end of the sidebar |
| ampforwp_before_meta_info_hook [ Design 1,2,3 ] | With the help of this hook, you can add additional meta tags in the beginning [Only in Design 1,2,3] |
| Actions Hooks | Description | Location |
| ampforwp_home_above_loop | This hook is used to add the things above the Homepage loop. | index.php |
| amp_before_loop [ Swift ] | This hook executes before the loop (Home and Archive). It can be used to add anything just above the loop. | index.php |
| ampforwp_post_before_loop | This hook executes before the loop (Home and Archive). It can be used to add anything just above the loop. | index.php |
ampforwp_between_loop | This hook executes in between the loop (Home and Archive). It can be used to add anything in between the loop. It has $count variable as a parameter which can be used to count the number of posts which can help greatly to decide where exactly you want to use this hook in the loop. | index.php |
| ampforwp_post_after_loop | This hook executes after the loop (Home and Archive). It can be used to add anything just below the loop. | index.php |
| amp_after_loop [ Swift ] | This hook executes after the loop (Home and Archive). It can be used to add anything just below the loop. | index.php |
| ampforwp_home_below_loop | This hook is used to add the things below the Homepage loop. | index.php |
| ampforwp_area_above_loop [ Design 3] | With the help of this hook, you can add additional information above the loop [only in Design 1,2,3] | index.php |
| ampforwp_frontpage_above_loop | This hook executes before the content of Frontpage. (These hooks will run on Custom FrontPage of Design 1,2 and 3 only) | frontpage.php |
| ampforwp_frontpage_below_loop | This hook executes after the content of Frontpage. ( These hooks will run on Custom FrontPage of Design 1,2 and 3 only ) | frontpage.php |
| Actions Hooks | Description | Location |
| ampforwp_post_before_design_elements | This hook runs before the elements like breadcrumb, title, content meta-info etc which are present in elements folder of each design. | single.php |
| ampforwp_post_after_design_elements | This hook runs after the elements like breadcrumb, title, content meta-info etc which are present in elements folder of each design. | single.php |
| ampforwp_single_design_type_handle_d1 | This hook executes after the Next-Previous Links. | single.php |
| ampforwp_below_author_box | With the help of this hook, you can add additional information below the author box | single.php |
| ampforwp_push_notification_widget | This hook is used to add web push widget markup in amp | single.php |
| ampforwp_global_after_footer | This hook executes at the end of the footer i.e., footer.php | footer.php |
| ampforwp_header_top_design{designno} | This hook executes at the beginning of Header | header-bar.php |
| ampforwp_header_search [ Design 1,2,3 ] | It executes the search button present in the header. You can use it to add your own search button as well. | header-bar.php |
| ampforwp_call_button [ Design 1,2,3 ] | It executes the call button present in the header. You can use it to add your own call button as well. | header-bar.php |
| ampforwp_header_bottom_design{designno} | This hook executes at the end of the Header. | header-bar.php |
| ampforwp_before_comment_hook | This hook executes right before the Comments. | comments.php |
| ampforwp_reply_comment_form | This hook executes right after the content of each comment. | comments.php |
| ampforwp_after_comment_hook | This hook executes right after the Comments. | comments.php |
| ampforwp_inside_post_content_before [Design-1] | This hook executes before the content. It works in Design-1 only. | content.php |
| ampforwp_before_post_content | This hook executes before the content. | content.php |
| ampforwp_after_post_content | This hook executes after the content. | content.php |
| ampforwp_before_content_hook | This hook executes before the content. | content.php |
| ampforwp_before_featured_image_hook | It executes right before the featured image in Single and Custom FrontPage. | featured-image.php |
| ampforwp_after_featured_image_hook | It executes right after the featured image in Single and Custom FrontPage. | featured-image.php |
| ampforwp_above_related_post | This hook executes right above the Related Posts in Single. | related-posts.php |
| ampforwp_between_related_post | This hook executes between the Related Posts in Single. It can be used to add things like Ads in between the related posts of single. | related-posts.php |
| ampforwp_below_related_post | This hook executes right below the Related Posts in Single. | related-posts.php |
| ampforwp_before_social_icons_hook | It runs before the Social icons in Single. | social-icons.php |
| ampforwp_after_social_icons_hook | It runs after the Social icons in Single. | social-icons.php |
| ampforwp_above_the_title | This hook runs before the Title in Single. | title.php |
| ampforwp_below_the_title | This hook runs after the Title in Single. | title.php |
Note: In Swift pages are served through page.php
| Actions Hooks | Description | Location |
| ampforwp_post_before_loop | This hook executes before the loop (Home and Archive). It can be used to add anything just above the loop. | archive.php |
| amp_before_loop [ Swift ] | This hook executes before the loop (Home and Archive). It can be used to add anything just above the loop. | archive.php |
| ampforwp_between_loop | This hook executes in between the loop (Home and Archive). It can be used to add anything in between the loop. It has $count variable as a parameter which can be used to count the number of posts which can help greatly to decide where exactly you want to use this hook in the loop. | archive.php |
| ampforwp_post_after_loop | This hook executes after the loop (Home and Archive). It can be used to add anything just below the loop. | archive.php |
| amp_after_loop [ Swift ] | This hook executes after the loop (Home and Archive). It can be used to add anything just below the loop. | archive.php |
| ampforwp_loop_before_pagination | This hook is used to add the things above the pagination | archive.php |
| ampforwp_before_meta_taxonomy_hook [ Design 1,2,3 ] | It executes right before the Meta taxonomy in Single. | meta-taxonomy.php |
| ampforwp_after_meta_taxonomy_hook [ Design 1,2,3 ] | It executes right after the Meta taxonomy in Single. | meta-taxonomy.php |
| Actions Hooks | Description |
| ampforwp_remove_unused_options | If you want to remove unused sections from AMP options panel then use this hook. |
| ampforwp_options_enabler | By using this hook you can enable the required options in the AMP Options Panel when AMP Theme Framework is activated. |
| ampforwp_options_remover | By using this hook you can remove the required options in the AMP Options Panel when AMP Theme Framework is activated. |
| amp_template_mode_hide_opt_array | By using this hook you can hide option in Template- mode |
| amp_template_mode_show_opt_array | By using this hook you can show option in Template- mode |
| Actions Hooks | Description |
| ampforwp_fbia_head | It is used to add extra things in Head section of FBIA which will come in handy if you want to add extra things in Head section |
| ampforwp_fbia_body | It is used to add extra things in the Body section of FBIA which will come in handy if you want to add extra things in Body section |
| ampforwp_fbia_footer | It is used to add extra things in the Footer section of FBIA which will come in handy if you want to add extra things in Footer section |
Here is an example showing how to use a hook by creating a custom plugin for AMP for WP and the below code will add a banner after the content in the AMP pages
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.
If you want to add an AWeber form in AMP then first you need to…
Webpushr is the fastest growing web push notifications platform that marketers love & developers rely…
Follow these steps to add Adobe Analytics in AMP Step 1: Go to WordPress Admin Area -> AMP…
Core Web Vitals are the subset of Web Vitals that apply to all web pages,…
The following reasons can be shown for non-indexing. Server error (5xx) Your server returned a 500-level…
We have added the Google Analytics 4 ( GA 4 ) integration in AMPforWP v1.0.80.…