WordPress.org

Ready to get started?Download WordPress

Forums

p2 theme with a custom post type and a page template (3 posts)

  1. fr33think3r
    Member
    Posted 4 years ago #

    I have ported p2 theme to be used as a page template with a custom post type. The results can be seen here.

    http://www.humbug.in/mblog/

    The code is hosted here:

    http://code.google.com/p/p2-theme-page-template/

    A lot of things are specific to my blog, and whosoever uses it will have to change it to their liking and blog schema.

  2. joehuffman2
    Member
    Posted 4 years ago #

    You didn't have to change the js to achieve adding post types? How does the AJAX get called? I am impressed, few people have tried to wander changing around P2.

    Bravo!

  3. fr33think3r
    Member
    Posted 4 years ago #

    I did have to change a bit of js, and some changes in ajax.php, but nothing major. Ajax gets called the same way as it is in the p2 theme. I just make sure the correct post_type gets used in wp_insert_post.

    $post_id = wp_insert_post( array(
          'post_author' => $user_id,
          'post_title'  => $post_title,
          'post_content'  => $post_content,
          'post_type'   => $p2_custom_post_type,
          'post_category' => array( $post_cat->cat_ID ),
          'tags_input'  => $tags,
          'post_status' => 'publish'
        ) );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags