WordPress.org

Ready to get started?Download WordPress

Forums

Simple title solution for P2 theme (8 posts)

  1. jasonmassengale
    Member
    Posted 4 years ago #

    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.

    @Ma.tt 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

    Find:
    $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".

  2. ECSDave
    Member
    Posted 4 years ago #

    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!

  3. ECSDave
    Member
    Posted 4 years ago #

    Hmmm,

    Jason, I tried your "mod" and didn't see a difference?
    See here: FreeAffiliateTraining.info Blog

  4. agck
    Member
    Posted 4 years ago #

    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?

    Thanks

  5. mrosarionyc
    Member
    Posted 4 years ago #

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

  6. D1G170S
    Member
    Posted 4 years ago #

    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.

    Tx

  7. texet
    Member
    Posted 4 years ago #

    It does something. It changes the PERMALINK URL.

    So instead of
    http://www.site.com/here-is-my-title-here-is-my-post

    You get:
    http://www.site.com/here-is-my-title

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

  8. texet
    Member
    Posted 4 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic

Tags