AMP Recent Posts



AMP Recent Posts Settings

NB. If you are NOT using the Automattic AMP plugin please implement the recent posts by adding this code to your plugins templates:

<?php echo do_shortcode( "[amp-recent-posts append='amp' heading='Recent Posts' max='5']" ); ?>

Use AMP plugin (Automattic) hook? />

This will implement the recent posts without the use of shortcode.

Priority of hook

We suggest you set this to 3, to play nice with our other plugins, if you wish to move the recent posts up of down change this number.

Set endpoint*

Unless you have changed this the AMP plugin uses 'amp', just letters no apostrophes. The endpoint is the last part of the URL to indicate AMP content.

Heading

Add an <H3> heading here.

Set number of posts*

The maximum of recent posts rendered, for example 5.

Return posts? " />

Check this to show recent posts, as opposed to -for example- 'pages'.

Other post types

If you wish to return a different post type set it here. (ex.: post, page, product, portfolio).

Display featured image? " />

Check this to show featured images.

Show date? " />

Check this to show the dates.

Exclude posts by ID

Some posts are more equal than others, you can find their ID in the admin URL of the post, page etc.




★★★★★ If you like this plugin please consider rating it, thank you!


 
AMP Recent Posts

Our other plugins

Articles

Keep in touch

array( $type1, $type2 ), 'order' => 'DESC', 'orderby' => 'date', 'showposts' => $maxamp, 'post__not_in' => array (get_the_ID(), $numm1, $numm2, $numm3, $numm4, $numm5 ), 'post_status' => 'publish', ); $attappendamp = get_option( 'append_amp' ); $attheadingamp = get_option( 'heading_amp' ); $ampthumb = get_the_post_thumbnail( 'thumbnail' ); echo '
'; echo '
'; echo '
'; echo '

'.$attheadingamp.'

'; echo '
    '; // The Query $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); // do something $ampthumb = get_the_post_thumbnail_url(); $ampthumbalt = get_the_title(); $ampdefimg = plugin_dir_url( __FILE__ ) . 'images/default-thumb.jpg'; $ampdate = get_the_date(); // Featured image + has thumb + date if ( get_option( 'sel_thumb_amp' ) == '1' && has_post_thumbnail() && get_option( 'sel_date_amp' ) == '1') { echo '
  • '.get_the_title().'

    '. $ampdate .'

  • '; } // Featured image + has thumb else if ( get_option( 'sel_thumb_amp' ) == '1' && has_post_thumbnail() && !get_option( 'sel_date_amp' ) == '1') { echo '
  • '; } // Featured image + NO thumb + date else if ( get_option( 'sel_thumb_amp' ) == '1' && !has_post_thumbnail() && get_option( 'sel_date_amp' ) == '1') { echo '
  • '.get_the_title().'

    '. $ampdate .'

  • '; } // Featured image + NO thumb + NO date else if ( get_option( 'sel_thumb_amp' ) == '1' && !has_post_thumbnail() && !get_option( 'sel_date_amp' ) == '1') { echo '
  • '; } // NO featured image + date else if ( !get_option( 'sel_thumb_amp' ) == '1' && get_option( 'sel_date_amp' ) == '1' ) { echo '
  • '.get_the_title().'

    '. $ampdate .'

  • '; } // NO featured image + NO date else if ( !get_option( 'sel_thumb_amp' ) == '1' && !get_option( 'sel_date_amp' ) == '1' ) { echo '
  • '; } } } else { echo '

    No recent posts found

    '; } echo '
'; echo '
'; echo '
'; echo '
'; // Restore original Post Data wp_reset_postdata(); } } // Shortcode function amp_recent_function($atts, $append, $heading) { extract(shortcode_atts(array( 'append' => 'amp', 'heading' => null, 'max' => 10, 'cpt1' => null, 'cpt2' => null, 'cpt3' => null, ), $atts)); $return_string = '