<?php
    /*
        Template Name: Entry node amp
    */

    //die;

    $count = (int)get_option('ampentrynode_count');
    $count = $count+1;
    update_option('ampentrynode_count', $count);

    $posts = get_posts(
        array(
            'post_status' => 'publish',
            'post_type' => array('anew','profile_article','yellow'),
            'posts_per_page' => 5,
            'orderby' => 'date',
            'order' => 'DESC'
        )
    );


    wp_redirect(get_permalink($posts[rand(0,4)]).'/amp/', 301);
    exit;

?>