0

I started working on a wordpress website, I need to show 20 words from every post with post name in Sidebar. I am new to wordpress, I am finding difficult to do it.

  • 2
    Which part of it do you need help with? Getting the posts? Trimming it to 20 words? Adding content to the sidebar? etc – Christine Cooper Jul 21 '16 at 15:26
1

This is a little broad and more than one approach is possible.

If you want to show posts in general sidebar area you would need to:

  1. Find and edit a template file responsible for that output in your theme
  2. Use WP_Query to query set of posts and output the results.

If you want to implement this in a sense of sidebar Widget (that can be controlled in admin to move it around and such) you would need to:

  1. Create a Widget, using Widget API.
  2. Again, use WP_Query for querying and output.

Given that your requirements are not that elaborate it might also be a good idea to look for existing plugins that offer post–listing widgets, they should be quite a few around.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.