• Resolved paolabozhilova

    (@paolabozhilova)


    Hi, I’m using BeТheme for my site. It is not compatible with amp at all. Is it possible to serve another theme for amp URL’s and how?
    Thank you in advance!

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Alberto Medina

    (@albertomedina)

    Since BeTheme is not AMP compatible at all, the best option right now is to use Reader mode, which will use a separate and simplified set of templates to serve AMP.

    With the upcoming 2.0 version (scheduled for August 18th, available now in beta), you will be able to chose any AMP compatible theme as the theme for the AMP version of your site. For example, any of the core themes such as TwentyTwenty.

    Plugin Author Weston Ruter

    (@westonruter)

    You can get an early look at this by testing the 2.0-beta1 prerelease. Notes and installation instructions at https://github.com/ampproject/amp-wp/releases/tag/2.0.0-beta1

    We plan to release 2.0.0-beta2 today. Watch for at https://github.com/ampproject/amp-wp/releases

    Thread Starter paolabozhilova

    (@paolabozhilova)

    Thank you very much!

    Thread Starter paolabozhilova

    (@paolabozhilova)

    Version 2.0 is great, has great functionality.
    Please tell me how/where can I edit the code of my chosen AMP theme in Reader mode?

    Plugin Author Weston Ruter

    (@westonruter)

    Which theme have you chosen for Reader mode?

    If the only thing you want to do is make style changes, you can use the “Additional CSS” feature in the Customizer. When you click “Customize” in the admin bar when looking at an AMP page, you’ll open an AMP Customizer with settings specific to the Reader theme. The styles provided in the Additional CSS section will be limited to just the AMP version.

    Otherwise, you’ll probably want to make a child theme of one of the core themes listed among the Reader themes. Then you can make the customizations to that child theme without modifying the code of the underlying theme, so you can avoid losing those changes when the core themes are updated.

    Let’s say you created a child theme of twentytwenty called veinteveinte. If you wanted this theme to then be included in the list of selectable reader themes, you can use this plugin code:

    <?php
    /**
     * Plugin Name: Add Veinte Veinte to list of AMP Reader Themes
     */
    
    add_filter( 'amp_reader_themes', function ( $reader_themes ) {
    	array_unshift(
    		$reader_themes,
    		[
    			'name' => 'Veinte Veinte',
    			'slug' => 'veinteveinte',
    			// 'screenshot_url' => '...', // Optional mobile screenshot.
    			'homepage' => 'https://www.ads-software.com/themes/twentytwenty/',
    			'description' => 'Child theme of Twenty Twenty',
    		]
    	);
    	return $reader_themes;
    } );

    Note: We released beta3 on Friday: https://github.com/ampproject/amp-wp/releases/tag/2.0.0-beta3

    Thread Starter paolabozhilova

    (@paolabozhilova)

    I use Twenty Seventheen in Reader mode.
    I understand. What I have to do is make a child theme by Twenty Seventheen and through Appearance ?Theme editor to make modifications. Then where do I add the filter you gave? In the function.php file of my current theme – BeTheme, right?

    Plugin Author Weston Ruter

    (@westonruter)

    You’ll be able to put the filter code in your functions.php once you update to 2.0-beta4 (or rather 2.0-RC1). But in reality it’s preferable to put that code in a new plugin.

    So you can create a PHP file like add-twentyseventeen-child-theme-to-reader-themes.php and put the above snippet in it, and then either you can upload that file to to the wp-contents/plugins directory or create a ZIP file and upload it into WordPress via the plugins screen. Then activate the plugin and your child theme should appear among the list of available Reader themes on the AMP settings screen.

    Thread Starter paolabozhilova

    (@paolabozhilova)

    I understood, thank you again!

    sherazshezi

    (@sherazshezi)

    Hy, I have a question on how to disable amp on posts of websites on desktop.

    this is my websites and amp also show on desktop.

    https://tikkaykhan.com/brandon-curry-biography/

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to switch theme for amp and non-amp pages’ is closed to new replies.