Ready to get started?Download WordPress


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

  1. fr33think3r
    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.


    The code is hosted here:


    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
    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.


  3. fr33think3r
    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