• Resolved morantivo

    (@morantivo)


    In my website i use acf (Advanced Custom Fields) and i want to show different field in the amp than the regular theme
    do i need to make anther theme only for amp and if yes what is the best way to do so
    or there is option to show field only on amp and not on in the desktop

    p.s i wrote my own theme

Viewing 4 replies - 1 through 4 (of 4 total)
  • @morantivo Apologies for the delay in responding. If you’re using AMP in reader mode you can simply apply any ACF input directly to the reader mode templates.

    If you’re using AMP in transitional or standard mode you can add the below conditions to your regular theme files to display a field in AMP URLs only.

    <?php
    if(function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
    {
    	echo '<p>' . get_field('field_name') . '</p>';
    }
    ?>

    Let me know if that answers your question of whether you have any further queries.

    Thread Starter morantivo

    (@morantivo)

    thanks, i use reader mode and it’s great
    amp/single.php working
    but now i stuck in different content type
    the content type is growing

    so i add to functions.php
    add_action( ‘amp_init’, ‘xyz_amp_add_review_cpt’ );
    function xyz_amp_add_review_cpt() {
    add_post_type_support( ‘growing’, amp_get_slug() );
    }

    and i add under the folder in my theme
    /amp/growing.php
    and
    amp/single-growing.php

    and it’s still not worki

    Thread Starter morantivo

    (@morantivo)

    I run speed test and i have few question
    https://gtmetrix.com/reports/www.growplants.org/zOWBKrGz

    1. why there is icon and can i delete ?
    amp/assets/images/placeholder-icon.png

    2. do i need lightbox? or i can delete it? if yes how (2 lighthouse

    4. the picture is 700*1200 can i use medium size image and if yes where in the code can i change it, can i lazy load or to delay in few second the load of the picture ( to change featured-image to medium) ( <?php $this->load_parts( [ ‘featured-image’ ] ); ?>)

    i know that it’s a lot of question so answer if it possible

    • This reply was modified 5 years, 11 months ago by morantivo.
    • This reply was modified 5 years, 11 months ago by morantivo.

    @morantivo You can enable support for custom post types using the plugins “Supported Templates” option, after you’ve already registered a new custom post type.

    In relation to the you other queries see below:
    1. It’s not recommended to overwrite any plugin files directly to customize your reader mode experience. You can however copy any of the templates from within the plugins templates directory and place them into a newly create amp folder within your active themes root directory. You can safely make modifications from there to these reader mode templates.

    You’ll find information below on how to modify the reader mode templates.
    https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/

    2. The lightbox effect is an element of the AMP framework, and personal preference whether you decide to keep it. There are different ways to disable this effect if you choose, with some methods listed at this resource.

    3. We don’t provide support or suggestions on image sizes or plugins. If you want to maintain valid structured data your featured image should be at least 1200 pixels wide.

    Hopefully that answers your questions. Be sure to share your experience of using the AMP plugin.

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

The topic ‘Show different acf in amp’ is closed to new replies.