• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Include specific post ID option in Foodie Featured Posts Widget

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Include specific post ID option in Foodie Featured Posts Widget

This topic is: not resolved

Tagged: featured posts widget, foodie pro

  • This topic has 10 replies, 3 voices, and was last updated 6 years, 8 months ago by Victor Font.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • September 20, 2018 at 1:02 pm #223323
    Deluxe Designs
    Member

    I understand that it is possible to add an option to include specific post IDs to the Foodie Featured Post Widget (similar to the GFWA plugin). From what I've read, you can use posts__in but I'm not sure what the code should be and where it should go in the foodie-featured-posts.php file.

    Any assistance is appreciated.

    September 20, 2018 at 2:54 pm #223324
    Brad Dalton
    Participant

    If you search the foodie-pro folder for wp_query, you'll find the display.php file contains a array of $query_args you can modify/add to around line 19.


    Tutorials for StudioPress Themes.

    September 20, 2018 at 9:31 pm #223333
    Deluxe Designs
    Member

    Ok, I see where to add the line of code, but my best guess as to what the code should be haven't worked. Any possibility you can spell it out for me? My trial and error is failing me.

    September 21, 2018 at 2:18 pm #223344
    Brad Dalton
    Participant

    Did you take a look at the post parameters for WP_Query?

    What have you tried so far?

    post__in should work.

    Post your code please.


    Tutorials for StudioPress Themes.

    September 21, 2018 at 2:26 pm #223345
    Deluxe Designs
    Member

    This is actually an older version of Foodie Pro that I've updated.

    The args look like this:

    `$query_args = array(
    'post_type' => 'post',
    'cat' => $instance['posts_cat'],
    'showposts' => $instance['posts_num'],
    'offset' => $instance['posts_offset'],
    'orderby' => $instance['orderby'],
    'order' => $instance['order'],
    );`

    September 21, 2018 at 2:31 pm #223346
    Brad Dalton
    Participant

    Where's the code you added?


    Tutorials for StudioPress Themes.

    September 21, 2018 at 2:34 pm #223347
    Deluxe Designs
    Member

    I removed it because I was really just guessing. I do not know what goes in the brackets.

    'post__in' => $instance['post__in'],

    September 21, 2018 at 2:48 pm #223348
    Brad Dalton
    Participant

    You need to hard code the post i'd's.

    Here's example arguments which show you how its done using the 'post__in' parameter

    https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters


    Tutorials for StudioPress Themes.

    September 21, 2018 at 4:00 pm #223349
    Brad Dalton
    Participant

    If you're not a coder, another solution is to create a featured category and add the posts you want featured without the need to edit code.

    that way you can use the widget settings.


    Tutorials for StudioPress Themes.

    September 21, 2018 at 4:09 pm #223351
    Deluxe Designs
    Member

    I'm comfortable editing most code but this one has stumped me. I prefer to do this by creating an option to include IDs. Your site is the only one I found that has this answer.

    September 22, 2018 at 12:49 am #223359
    Victor Font
    Moderator

    'post__in' accepts an array of post ids as its argument. That array does not exist in the widget defaults. This means $instance won't work. You would either have to manually as in this example:

    'post__in' => array('1', '2', '3', '4'),

    Or add it to the defaults, create an entry point for a string of post ids in the widget interface, and convert the string to an array so post__in can accept it.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble