Feature request: setting default post type (6 posts)

  1. Tony Scott
    Posted 4 years ago #

    I know this has been raised before on a number of occasions, and various hacks have been posted to enable this, but could consideration be given to including a way in the theme options to set the default post type (eg from Status Update to Blog Post) in the next version of P2?




  2. Hacky but "works for me" in a mu-plugin / child theme functions.php workaround:

    function p2_use_blog_posttype() {
    	if ( p2_user_can_post() && !is_archive() && is_front_page() )
    		if ( !isset( $_GET['p'] ) )
    			$_GET['p'] = 'post';
    add_action( 'wp_head', 'p2_use_blog_posttype' );
  3. Tony Scott
    Posted 4 years ago #

    Westi, that works - but as you told me in another place, you need to copy the P2 inc subdirectory to the P2 child theme.

    However, my point about building the option to set the default post type into the next version of P2 still stands.

  4. benjudy
    Posted 4 years ago #

    I can't find the function listed above. I'm on p2 version 1.4.0. Has something changed?

    Anyway, I just spent three incredibly frustrating hours trying to make Blog Post the default post type on my site. I've scoured this forum, found many threads addressing the issue, but not yet found a 100% working solution.

    I'm not an advanced PHP or Javascript programmer but I don't mind hacking around. I just don't know enough to solve this riddle without help.

    I tried every "fix" listed in these forums. I even tried modifying my child theme so that the four post type options are gone, and blog post is the only option available. No matter what I do, I can't find a way to prevent p2 from assuming I want to submit a status update!

    I will buy lunch and a beer for anyone who can provide a 100% working solution. Don't really care if it's a plugin, or instructions for a hack, or modifying the p2 theme... anything to help us folks who don't want Status Update as the default mode, and who just want to use Blog Posts with p2.

  5. macmeister
    Posted 4 years ago #

    Did anyone find a solution? We simply hacked the tabs, and removed the option for the others... But now to apply it again in the newest version yet. Please consider making this a checkbox P2 folk. A default or way to disable others would be SWEET within the admin! Adding Peter's hack appears to work as well.

  6. htrex
    Posted 4 years ago #

    I'm using this snippet of code in a JS file loaded from a child theme:

    (function($) {
     $(document).ready(function() {
             var defps = setTimeout(function(){
                    $('#post-types a#post').trigger('click');

    hacky but works without problems

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic