Support » Requests and Feedback » Simple title solution for P2 theme

  • Keep the simplistic beauty of P2 while adding the option for customized titles by using the first line as the title. If there’s no first line break, title it as usual. or @noel – if you run across this, it would be cool if you added it to future releases. It’s simple and doesn’t change much.

    In functions.php under the function – prologue_title_from_content on line 538

    $title = str_replace("\n", " ", $title);

    And replace it with:

    // BEGIN first line title fix
    $first_line_title = explode( "\n" , $title );
    $title = $first_line_title[0];
    // END first line title fix
    //$title = str_replace("\n", " ", $title);

    I commented out the original line but left it there just in case I changed my mind and wanted to go back (since I’m kind of a php newb). When you upgrade P2 to the next version, that line will be wiped out so keep that in mind.

    The Fix:
    It will set your post title and be reflected in the permalink.

    The Problem:
    It doesn’t show up as a H2 title in the “feed” for some reason.

    I’m guessing there’s a special hook or something on the actual edit post page that triggers the title being set in WP (that’s more than I was interested in getting into).

    Taking it a little farther:
    It should be pretty easy to add a checkbox to the P2 options page to give users the option to “Use first line as title”.

Viewing 7 replies - 1 through 7 (of 7 total)
  • This would be nice!

    show up as a H2 title in the “feed”… give users the option to “Use first line as title”

    Please, may we have this, LOL!


    Jason, I tried your “mod” and didn’t see a difference?
    See here: Blog

    Do i need to do any setting for users? shall i make them Authors when they subscribe in my blog so they can post in P2 theme or no need?

    are there any special plugins i need to add for my wordpress “self-hosted to run P2 Prologue theme?


    Hello. I was able to tweak the code by moving around the fields. I moved the “Tags” field to the top and renamed the field to show “Post Title” instead of “Tags”… Now, everytime a user posts following this format, the post shows with Title and then the Content…. This is my quick fix while they figure out how to change this. It would be nice to add a Title field as I am using this theme as a blogging tool for registered users….

    Hi, I tried to run the code, but does nothing. The Theme still donĀ“t use the first line as title.

    I don’t know what is the problem, please help me.


    It does something. It changes the PERMALINK URL.

    So instead of

    You get:

    the lack of H2s is the problem. Somehow, there must be a way to insert $title into post_title using the .js files.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Simple title solution for P2 theme’ is closed to new replies.