Support » Plugin: AMP for WP - Accelerated Mobile Pages » Show multiple Post Types in homepage

  • Resolved dtszero



    I want to show my custom post types in the default homepage of amp, I already added the support on Settings->General->AMP Support->Custom Post Types.

    But in the,
    Design->Homepage->Loop Display Controls->Post Type in Loop,
    I can only select one.

    Someway to choose multiple Post Type?


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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Marqas


    Hi @dtszero,

    Do you want to show the loop for multiple Custom Post Types?



    Hi @marqas,

    Yes I have 4 custom post types and I want to show all of this with the WordPress default ‘post’ on my homepage.

    In my normal theme I use this code to show up all

    // Show on home
    function print_ani_man_posts($query) {
      if( !is_admin() && $query->is_main_query() && is_home() ) {
        $query->set('post_type', array('post', 'anime', 'manga', 'pelicula', 'ova'));
    add_action('pre_get_posts', 'print_ani_man_posts');
    # Show on home

    But isn’t working with AMP.



    I found an article on your blog,

    I leave a part of the your code:

    Plugin Name: AMP Home Page Modify
    Version: 0.0.1
    Author: Mohammed Khaled
    Author URI:
    Donate link:
    License: GPL2
    // Exit if accessed directly.
    if ( ! defined( 'ABSPATH' ) ) exit;
    //Use Case 2: Show posts from different Post types
    function ampforwp_return_loop_args(){
        // learn more to Modify args @
        //remove code between these comments and replace with your code here
      $q = array(
                'post_type'           => array( 'post', 'custom_1', 'custom_2' ),
                'orderby'             => 'date',
                'ignore_sticky_posts' => 1,
        return $q;
    function ampforwp_custom_home_output(){
      add_filter('ampforwp_query_args', 'ampforwp_return_loop_args');

    Thanks! I solve this,


    • This reply was modified 1 year ago by  dtszero. Reason: ; fix
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show multiple Post Types in homepage’ is closed to new replies.