WordPress.org

Forums

P2
H4 holding post metadata needs CSS class (3 posts)

  1. Manuel Schmalstieg
    Member
    Posted 1 year ago #

    If someone wants to add some simple CSS styling to a P2 child theme, it's necessary to have CSS classes that clearly identify the main building blocks of the layout.

    I bumped into one problem: the post header is contained in a naked <h4> tag, with no CSS class that could serve as a styling selector.

    I'm talking about the heading section that contains:

    • the author name
    • the publication date
    • the action buttons (Permalink/Reply/Edit)
    • the tags

    The latter three items are grouped inside a <span class="meta">, so they can be styled easily. But the author name is sitting inside a naked <a href> tag so styling it with no selectors gets quite ugly (using ".entry h4 a {}" is likely to induce side effects).

    The way I fix this in my P2 child theme:

    • I modify entry.php, and change <h4> to <h4 class="postmeta"> on line 30.
    • I modify comments.php, and add a custom callback function.
    • In my functions.php, I add my custom callback function, which is actually a clone of p2_comments(), with <h4> (line 371) changed to <h4 class="commentmeta">.

    This gives me a solid CSS class for the intended styling.

    I would be handy if such a class would be there by default (as is the case for the post content area).

  2. Thanks for outlining these tweaks so other folks can use them.

    p2 is currently in maintenance mode, so new enhancements aren't likely to be added.

    Keep your eye out for its successor, o2: http://geto2.com/

  3. Manuel Schmalstieg
    Member
    Posted 1 year ago #

    Yes, I'm very very impatient to get my hands on o2 :)

    Before posting this I checked the last update of P2, which is 2014-02-13 - so I thought it's still somehow maintained.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags