WordPress.org

Ready to get started?Download WordPress

Forums

TwentyTwelve Child Theme - Customise Widget? (4 posts)

  1. robshorland
    Member
    Posted 1 year ago #

    Hi All,

    I am currently working on a TwentyTwelve Child Theme and would appreciate some direction/best parctise advice to have the First Front Page Widget Area display only posts from a single category?

    I have looked at many ways to do this including:
    // Adding the php get_posts() with relevant parameters to the page template.

    // Using a 3rd party plugin such as "Featured Category Posts Widget" or other similar ones.

    // Or presumably create a new function in the Child Themes functions.php and assign it to the widget area somehow.

    All of these approaches, whilst seemingly feasible don't appear to be optimal and (arguably) are not making best use of functionality that is already present.

    There is already a "Recent Posts" widget available and I simply want to select a single category for it to output. Therefore would the best approach be to create a duplicate of the "Recent Posts" widget and add the filter for the category I want to display and rename the duplicate widget to "Recent Posts:News" for example?

    Apologies for the long-winded question, but I am begining to liken this to skinning a cat and would be really grateful for direction.

    Rob

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    You might be better off creating your own custom widget.

  3. robshorland
    Member
    Posted 1 year ago #

    Thanks for the suggestion Esmi, but I was hoping to maybe just duplicate the existing "Recent Posts" widget and add an extra (category name=News) parameter to it and rename the widget to "Recent Posts:News" so its unique.

    I really don't want to reinvent the wheel here and I am trying to keep things light and easy to follow up at a later stage.

    Do you think duplicating the parents existing widget in the child theme could work?

    Thanks all,

    Rob

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    I was hoping to maybe just duplicate the existing "Recent Posts" widget and add an extra (category name=News) parameter to it

    That would effectively be extending the existing widget - which is pretty much what that article is about.

Topic Closed

This topic has been closed to new replies.

About this Topic