• On the front page of my site, I’m pulling in the latest blog post like this:

    <?php query_posts('showposts=1'); ?>

    I only want to pull in the first 100 words, though. Is there a parameter for this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You can display the first 100 words, but I think you’ll have to get the whole post + meta + comment count, etc. (if you want to use them).

    Thread Starter Darren

    (@cutout)

    How do I set the parameter for number of characters?

    Try using “the_excerpt()” instead of “the_content()” in the loop.

    Thread Starter Darren

    (@cutout)

    Excellent! Thanks for the suggestion. I’m pulling in the excerpt, but WP is automatically wrapping it in a paragraph tag. Any way around this?

    Easiest is in the css:
    “reference to the container” p {margin:0;padding:0;}

    Thread Starter Darren

    (@cutout)

    Unfortunately, the excerpt bit occurs within a <span>. Putting a block element (p) inside the span breaks validation regardless of the padding or margins. Any way to hack into the WP core files and delete the paragraph tag altogether?

    There’s a plugin, disable wpautop (or similar). May break something else…

    Thread Starter Darren

    (@cutout)

    I’ve actually got that plugin. I’ve turned it on and off, but no dice.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Set character limit in the query_posts function?’ is closed to new replies.