How to create a custom AMP WordPress theme with level-up framework

Follow these steps to create a LevelUp Custom Theme

Step 1: First you need to open wp-content/themes/ in your WordPress installation folder and create a new folder for your customtheme. You can name this folder anything you want. For this tutorial, we will be naming it customtheme and create that folder as well in your installation like below the screenshot.

Step 2: We are now going to create three empty files in this directory. One is called index.php, functions.php and the other is called style.css.

Step 3: Open a text editor like Notepad and paste this code and save this file as “style.css”  in the customtheme folder, you just created.

/*
 Theme Name:   Custom Theme
 Theme URI:    https://customtheme.com/
 Description:  A customtheme
 Author:       Ahmed Kaludi
 Author URI:  http://magazine3.company/
 Version:      1.0.0
*/

Step 4: In the index.php file, we just want to output something to the screen to prove that our custom theme is working.

Custom Theme!

Step 5: You can now go to WordPress Dashboard ->Appearance -> Themes where you will see customtheme. You need to click on the activate button to start using the customtheme on your site.

Now we are ready to add AMP support

First, you need to install and activate AMPforWP plugin.

In theme folder, functions.php file and you need to find “add_action” hook “after_setup_theme” and inside this action, you need to add this below code.

add_theme_support( 'amp-template-mode' );

In this header.php file, you need to add code inside wp_head() function.

Now your theme successfully converted into AMP theme you can check with AMP Validator.

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.

Share
Published by
Sonali R

How to create an AWeber form in AMP

If you want to add an AWeber form in AMP then first you need to…

3 years ago

How to setup webpushr notification in AMP

Webpushr is the fastest growing web push notifications platform that marketers love & developers rely…

3 years ago

How to add Adobe Analytics in AMP

Follow these steps to add Adobe Analytics in AMP Step 1: Go to WordPress Admin Area -> AMP…

3 years ago

What is the CWV plugin all about

Core Web Vitals are the subset of Web Vitals that apply to all web pages,…

4 years ago

How to fix “Alternate page with proper canonical tag” Page Index issue in Google Search Console

The following reasons can be shown for non-indexing. Server error (5xx) Your server returned a 500-level…

4 years ago

Google Analytics ( GA4 ) integration in AMPforWP

We have added the Google Analytics 4 ( GA 4 ) integration in AMPforWP v1.0.80.…

4 years ago