Assign a class to the paragraph containing the read-more-link

  1. jaZoo


    I would be glad if in an upcoming WP versions it woul be possible to assign a class to the p-tag containing the read-more-link. This is for two reasons:

    1) Theme designers could style read-more-links differently.
    2) When using drop-caps via the :first-letter pseudoclass the p-tag containing the read-more-link will be affected, too. It is possible to style every p:first-letter which shall not be displayed as a drop-cap differently, but some attributes such as "color" won't look the same on every browser, if the paragraph starts with a link (like the read-more-link). If this particular paragraph had its own class, it would be possible to style it directly.


    Let me show you an example:

    1. div.post-body p:first-letter would affect every single p-tag
    2. div.post-body p + p:first-letter would affect every p-tag except the first one being a child of the div.post-body

    This will style only the first p-tag of the post:

    div.post-body p:first-letter { some drop-caps styles, different color, size etc. }
    div.post-body p + p:first-letter { style of the regular text, regular color, size etc. }

    But when using different colors for the drop-caps and therefore assigning the usual text-color to :first-letter of all the other p-tags, it overrides the styles for links.
    IE has no problems with that and will display everything in the desired way. Firefox will only solve this problem when "inherit" is used, but IE will then mess with every other paragraph.

    The read-more-link is wrapped in a p-tag which is affected of the above codes. Because the CSS says that the first letters of all the paragraphs except the first one shall be black or whatever the regular text looks like, and the read-more-paragraph starts with a link, the "R" will have the regular text color, even if the "ead more" is red or blue or whatever.

    I have uploaded a screenshot showing what Firefox will display.


    It would be fairly easy to solve this problem if the p-tag containing the read-more-link had its own class but without it, one has to produce invalid html to solve it.

    This is why I would really appreciate it if upcoming WP versions would give me the possibility to assign a class to that p-tag!

    Thanks and best regards,

    Posted: 9 years ago #
  2. There is no need to make any sort of changes like this. The proposal can already be done by theme developers.

    The post style is marked up on the single.php

    The excerpted bit before the read more is marked up on any other page calling for the post. Furthermore html and markup tags can be called before and after the "read more" text simply by inserting it into the template.

    Posted: 9 years ago #
  3. Justin Tadlock
    WordPress God


    The more link is already given a class. I can't think of any reasons why the paragraph around it would need a class.


    Not everyone puts their more link in a new paragraph either. I'm thinking this is something that isn't needed on most installs.

    Posted: 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    2 Votes
  • Status

    This is theme territory