////// This is my longterm problem help me friends //////

Discussion in 'Programming' started by strgraphics, Jan 5, 2010.

  1. #1
    This may be easy to you...,

    i am giving posts by limiting the content in the homp page by "500"

    i used <?php the_content_limit(500, ""); ?>

    function:

    function the_content_limit1($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "<p>";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Read More &rarr;</a>";
          echo "</p>";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "<p>";
            echo $content;
            echo "...";
            echo "&nbsp;<a href='";
            the_permalink();
            echo "'>".$more_link_text."</a>";
            echo "</p>";
       }
       else {
          echo "<p>";
          echo $content;
          echo "</p>";
       }
    }
    PHP:





    the output i am getting as..
    [​IMG]


    But in some other sites i found the same but they are getting paragraphs but i am getting single paragraph

    [​IMG]


    How to get the paragraphs
     
    strgraphics, Jan 5, 2010 IP
  2. Kalyse

    Kalyse Peon

    Messages:
    1,221
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is your content formatted in paragraphs? If it doesn't include <br>,<p> in there then thats not going to happen.
     
    Kalyse, Jan 8, 2010 IP
  3. strgraphics

    strgraphics Active Member

    Messages:
    710
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Ohh k k thanks friend. i will try this.... thanks a lot
     
    strgraphics, Jan 11, 2010 IP