0

I'm new in wordpress theme development. I want to display recent posts via recent post widget. but when I active the Recent posts widget in wordpress admin panel it only shows the title but not the images. But when i write a custom code in sidebar it works fine. I want to work it like a widget perfection. I do not want to use any plugin, help me in custom code.

0

1 Answer 1

0

Have a look at the WP_Widget_Recent_Posts class in wp-includes/default-widgets.php to see how it is structured.

You can even copy and paste the class in your functions.php, rename it to something else and modify the class to display your images.

And don't forget to add a register_widget('NameOfYourClassHere'); hooked to widgets_init.

1
  • Thanks RRikesh. it worked on me and i also got new info about widget panel. :) Commented Dec 3, 2014 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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