WordPress.org

Ready to get started?Download WordPress

Forums

Portfolio and "recent posts" widget (6 posts)

  1. norrie
    Member
    Posted 1 year ago #

    Hi. Is there a way I can have the recent posts widget show the title of the posts from my portfolio (set up with custom post type) instead of my blog?

  2. luckdragon
    Member
    Posted 1 year ago #

    there are several tutorials on how to create your own widgets, in this case all you really want to do is copy the recent posts widget and modify it appropriately to choose the correct post_type.

    you can copy the code from wp-includes/default-widgets.php

    search for:

    /**
     * Recent_Posts widget class
     *
     * @since 2.8.0
     */

    copy everything between that and:

    /**
     * Recent_Comments widget class
     *
     * @since 2.8.0
     */

    paste it into your functions.php for your theme (or another file which you include), and make the appropriate modifications.

  3. norrie
    Member
    Posted 1 year ago #

    Thanks luckdragon but being new to wordpress, I can't find the post_type I need to change amongst all that code. Any chance you might be able to point it out?

  4. BeautyPirate
    Member
    Posted 1 year ago #

  5. luckdragon
    Member
    Posted 1 year ago #

    when you click on "portfolio" on your admin menu it should take you to a url like

    wp-admin/edit.php?post_type=<something>

    whatever that <something> is, is the post type you need.

  6. norrie
    Member
    Posted 1 year ago #

    Thanks a million!

Topic Closed

This topic has been closed to new replies.

About this Topic