Support » Requests and Feedback » p2 theme with a custom post type and a page template

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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!

    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'
        ) );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘p2 theme with a custom post type and a page template’ is closed to new replies.