• Hi, is it possible to have a seperate blog page? I want to create a stripped down version of our website with all important pages and – of course – a seperate blog page.

    How do I have to modify the plugin to reach this goal?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor ampforwp

    (@ampforwp)

    Hey @sebastian78do

    So you want to display latest posts (loop) in a separate page (/blog)? Did I get it right?

    If you give more inputs, so that we can help you.

    Thread Starter sebastian78do

    (@sebastian78do)

    Hello, exactly. How can I display the latest posts on a seperate page e.g. /blog as already on my homepage? I enabled Homepage Support and defined a Frontpage.
    I haven’t found any settings to choose a blog page.

    Plugin Contributor ampforwp

    (@ampforwp)

    Hey @sebastian78do

    I totally understand what you are saying. As of now we don’t have that feature. However, we will consider your use case. I have created this as an issue in GitHub, you can see that here > https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/737

    This will be added in future updates.

    Thank you so much for your inputs.

    Thread Starter sebastian78do

    (@sebastian78do)

    Hello again, thank you for your quick reply. What about a temporary workaround via a shortcode in functions.php?

    In the following example I used the loop of Design 1. Currently it doesn’t work because I don’t know how to replace ‘$this’ with a proper object.

    function ampblog( $atts ) {
    global $redux_builder_amp;
    extract( shortcode_atts( array (
    ‘paged’ => 1,
    ‘exclude_ids’ => ”
    ), $atts ) );

    $args = array(
    ‘post_type’ => ‘post’,
    ‘orderby’ => ‘date’,
    ‘paged’ => esc_attr($paged),
    ‘post__not_in’ => $exclude_ids,
    ‘has_password’ => false ,
    ‘post_status’=> ‘publish’
    );
    $filtered_args = apply_filters(‘ampforwp_query_args’, $args);
    $q = new WP_Query( $filtered_args ); ?>

    <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); ?>
    <div class=”amp-wp-content amp-wp-article-header amp-loop-list”>

    <h1 class=”amp-wp-title”>
    <?php $ampforwp_post_url = get_permalink(); ?>
    “><?php the_title() ?>
    </h1>

    <div class=”amp-wp-content-loop”>
    <div class=”amp-wp-meta”>
    <?php $this->load_parts( apply_filters( ‘amp_post_template_meta_parts’, array( ‘meta-author’) ) ); ?>
    <time> <?php
    printf( _x( ‘%1$s ‘. $redux_builder_amp[‘amp-translator-ago-date-text’], ‘%2$s = human-readable time difference’, ‘wpdocs_textdomain’ ),
    human_time_diff( get_the_time( ‘U’ ),
    current_time( ‘timestamp’ ) ) ); ?>
    </time>
    </div>

    <?php if ( has_post_thumbnail() ) { ?>
    <?php
    $thumb_id = get_post_thumbnail_id();
    $thumb_url_array = wp_get_attachment_image_src($thumb_id, ‘thumbnail’, true);
    $thumb_url = $thumb_url_array[0];
    ?>
    <div class=”home-post-image”>
    “>
    <amp-img
    src=<?php echo $thumb_url ?>
    <?php if( $redux_builder_amp[‘ampforwp-homepage-posts-image-modify-size’] ) { ?>
    width=<?php global $redux_builder_amp; echo $redux_builder_amp[‘ampforwp-homepage-posts-design-1-2-width’] ?>
    height=<?php global $redux_builder_amp; echo $redux_builder_amp[‘ampforwp-homepage-posts-design-1-2-height’] ?>
    <?php } else { ?>
    width=100
    height=75
    <?php } ?>
    ></amp-img>

    </div>
    <?php }
    if(has_excerpt()){
    $content = get_the_excerpt();
    }else{
    $content = get_the_content();
    } ?>
    <p><?php echo wp_trim_words( strip_shortcodes( $content ) , ’20’ ); ?></p>
    </div>
    </div>
    <?php endwhile; ?>

    <div class=”amp-wp-content pagination-holder”>

    <div id=”pagination”>
    <div class=”next”><?php next_posts_link( $redux_builder_amp[‘amp-translator-next-text’]. ‘ »’, 0 ) ?></div>
    <div class=”prev”><?php previous_posts_link( ‘« ‘. $redux_builder_amp[‘amp-translator-previous-text’] ); ?></div>
    <div class=”clearfix”></div>
    </div>

    </div>

    <?php endif;

    }
    add_shortcode (‘ampblog’, ‘ampblog’ );

    • This reply was modified 7 years, 8 months ago by sebastian78do.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘AMP pages and seperate blog roll’ is closed to new replies.