1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What do I need to add to this to get it to work?

Discussion in 'Blogging' started by iamsgf, Dec 1, 2008.

  1. #1
    Hi All,

    I am trying to modify a theme. Currently it is showing the full post details on the home page however I want to limit the number of words that it shows.. ie 100.

    The code pulling this is:

    <?php
    $content = get_the_content('Continued &raquo;');
    if (strlen($content) > 200 && !eregi("Continued &raquo", $content))
    $i++;
    ?>

    What do I need to add so that I limit the number of words or characters with a More/Read Full post link.

    Thanks
     
    iamsgf, Dec 1, 2008 IP
  2. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #2
    mizaks, Dec 1, 2008 IP
  3. iamsgf

    iamsgf Active Member

    Messages:
    982
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    85
    #3
    A plugin is no good to be, cos the theme is hard coded!
     
    iamsgf, Dec 1, 2008 IP
  4. ThePhoenixBird

    ThePhoenixBird Well-Known Member

    Messages:
    255
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    130
    #4
    <?php
    $content = get_the_content('Continued &raquo;');
    if (strlen($content) > 200 && !eregi("Continued &raquo", $content))
    $i++;
    ?>

    At simple sight i think that you should change the 200 to 100?
    Anyways i havent read the rest of the code to be sure.
     
    ThePhoenixBird, Dec 1, 2008 IP
  5. iamsgf

    iamsgf Active Member

    Messages:
    982
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    85
    #5
    Thank, but no cigar.........

    Tried that one.
     
    iamsgf, Dec 1, 2008 IP
  6. iamsgf

    iamsgf Active Member

    Messages:
    982
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    85
    #6
    ok I have now got this far.

    <?php
    $content = get_the_content('Continued &raquo;');
    if (strlen($content) > 200 && !eregi("Continued &raquo", $content)) {
    $content = substr(strip_tags($content), 0, 200) . "...";
    }
    $i++;
    ?>

    This reduces the content on the home page to short, however it uses the strip_tags that removes the html so that the Image does not show.

    Can anyone get me that one step further to show image with the 200 character limit in place.

    Thanks
     
    iamsgf, Dec 1, 2008 IP
  7. hmansfield

    hmansfield Guest

    Messages:
    7,904
    Likes Received:
    298
    Best Answers:
    0
    Trophy Points:
    280
    #7
    Why can't you just use the "read more" tool that is already embedded in the post editor ? It will cut off the post where ever you insert it.
     
    hmansfield, Dec 1, 2008 IP
  8. iamsgf

    iamsgf Active Member

    Messages:
    982
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    85
    #8
    Doh!! I keep forgetting that feature exists....... thanks
     
    iamsgf, Dec 2, 2008 IP