Soporte » Plugins y Hacks » ERROR LLAMADA QUERY POST A CUSTOM POST TYPE

  • Buenas,
    HE estado revisando mensajes y el codex y no encuentro mi error. A ver si alguien puede ayudarme

    He creado un plugin para hacer un nuevo CUSTOM POST TYPE.

    este es el código:

    <?php
    /*
    Plugin Name: POPUP CUSTOM TYPE
    */
    
    add_action('init', 'popup_custom_type');
    
    function popup_custom_type(){
    	register_post_type('popup_custom_type',
    		array(
    			'labels' => array(
    				'name' => 'Popup Custom type',
    				'menu_name' => 'Popup Posts'),
    			'singular_label' => 'Popup Custom Type',
    			'public' => true,
    			'capability_type' => 'post',
    			'has_archive' => true,
    			'hierarchical' => false,
    			'show_in_menu' => true,
    			'supports' => array( 'title', 'editor', 'author', 'revisions', 'comments')
    			)
    		);
    }
    ?>

    He creado una plantilla, que se llama single-custom_post_type.php con esta llamada:

    <?php
    $query = array(
        'post_type' => 'popup_custom_type',
        'showposts' => 1,
        'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private',     'inherit', 'trash')
    );
    query_posts($query);
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; else: endif; ?>

    Y posteriormente he creado mi custom post type, cuando pre-visualizo en versión draft, me aparece perfectamente, con estilos y todo. Pero cuando publico, nada, me sale este error:
    Sorry, no posts matched your criteria.

    ¿Alguien sabe qué puede estar pasando???

    Graciass

  • El debate ‘ERROR LLAMADA QUERY POST A CUSTOM POST TYPE’ está cerrado a nuevas respuestas.