Support » Plugin: Simple Preview » Support for Custom Post Types

  • Resolved Laura

    (@lauraquellmalz)


    Okay, I’ve added the support for custom post types:

    
    // hack to add custom post types to the query
    $oPost = get_post( $this->id );
    $this->post_type = $oPost->post_type;
    add_action( 'pre_get_posts', array( $this, 'add_post_type_to_query' ) );
    add_filter('posts_results', array(&$this, 'fake_publish'));
    
    function add_post_type_to_query( &$query ) {
        $query->set( 'post_type', $this->post_type );           
    }
    

    And add $post_type to the class vars.

    Cheers!

Viewing 1 replies (of 1 total)
  • Plugin Author Nagmay

    (@gabrielmcgovern)

    Excellent suggestion! Adding this to next release.

Viewing 1 replies (of 1 total)
  • The topic ‘Support for Custom Post Types’ is closed to new replies.