WordPress.org

Support

Support » Themes and Templates » P2 » [Theme: P2] Blogpost as Default Post Type

[Theme: P2] Blogpost as Default Post Type

  • I recognize that this question has been asked before, but the answers are old,don’t seem to apply to the latest (1.3.3) version of P2, and are not definitive as far as my trials have revealed.

    I’m looking to change the default post type from Status to Blog Post. I can get as far as changing the function that controls the default post type: p2_get_posting_type in the template-tags.php file, changing “status” to “post”:

    function p2_get_posting_type() {
    	$p = isset( $_GET['p'] ) ? $_GET['p'] : 'status';
    	return $p;
    }

    which gets me 75% there. The Blog post then becomes the default, but there is something still not quite right. An initial post works fine, but on subsequent posts, the Post Title area doesn’t reset, it holds onto the Title from the initial post. If you delete the title, then click “somewhere else” on the site, then click back in the Title field, the “Post Title” prompt returns.

    What could be leading to the title field not “resetting” itself for subsequent entries?

    http://wordpress.org/extend/themes/p2/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello mrjarbenne,
    I have exactly the same problem, I need to make the ‘Blog Post’ title input field have focus on load, after making the changes you illustrate above. Did you find a solution?
    Cheers,
    John.

    I wasn’t able to find a solution to this, and subsequently reverted back to the default settings as this glitch was confusing for my users. I would love to revisit this though if you find a solution.

    Good luck.

    @mrjarbenne Did you check for javascript errors? It’s an odd glitch because the title field should get cleared after submitting a post. Does the post text get cleared? The post text and post title get cleared one after the other through javascript functions after a post is successfully submitted. Lines can be found in p2.js inside the newPost function

    $('#posttext').val('');
    			$('#posttitle').val('');

    Did you make other customizations to p2.js or post-form.php? I wouldn’t mind troubleshooting if you have a live example I can look at.

    @john that’s not entirely the same issue. Right now P2 doesn’t set the focus for the input fields very intelligently. If all you want is to focus the title field on page load, you can try this mini hack:
    find this code in p2.js

    if(!window.location.href.match('#'))
    		$('#posttext').focus();

    and replace with

    if(!window.location.href.match('#'))
    		$('#posttitle').focus();

    This is assuming you’ve already set the blog post to be the default format.

    Thanks Nobble, the hack works fine, and I have now removed the (li) for ‘status post’ as well so the landing page has just the three posting options. Thanks again.
    John.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Theme: P2] Blogpost as Default Post Type’ is closed to new replies.
Skip to toolbar