WordPress.org

Ready to get started?Download WordPress

Forums

Replace tags in posts? (2 posts)

  1. Rander
    Member
    Posted 8 years ago #

    Right, I'm trying to build my own template, and my my problem is this:
    If a post contains a line-break, then the command the_content(__('[read more...]')) converts the line-breaks to . The problem is, that I need it to convert them to
    to make my stylesheet do what I want it to...
    I've tried doing <?php str_replace ("", "</P><P>", (the_content(__('[read more...]')))); ?>, but it seems to do nothing at all...
    So, can this be done, without hacking the WordPress files?

  2. Rander
    Member
    Posted 8 years ago #

    Okay, maybe I should elaborate on this...
    In my style.css, I have the following line:
    .Post { TEXT-INDENT: 1em; }
    My loop is then wrapped in a <div class="Post">. All this to indent the first line of each paragraph.
    Now, the problem is, that when i do the_content(__('[read more...]')), It indents the first line of the post only!. This is because the post gets formatted with a <p> at the beginning, a </p> at the end, and at the linebreaks, it inserts a <br />. This is, at least in my head, wrong. It should replace the linebreaks with </p><p>, as this is more correct (in my head), and it gives some extra options for styling.
    I tried replacing the line with <?php str_replace ("", "</p><p>", (the_content(__('[read more...]')))); ?>, but that line seems to make no difference to the output at all!
    Now, can the <br /> tag be replaced with the more correct </p><p> without hacking the WordPress files themselves? Could this possibly be an idea for a plugin?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags