• 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

Genesis (Streamline Pro) Post__In Blogroll Issues

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 › Genesis (Streamline Pro) Post__In Blogroll Issues

This topic is: not resolved

Tagged: blogroll, post__in, pre_get_posts

  • This topic has 8 replies, 2 voices, and was last updated 7 years, 6 months ago by robindean.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • December 23, 2017 at 4:19 pm #214775
    robindean
    Member

    Hello, all.

    I have an array of 10 post IDs.

    Sorted in the same order as the array itself (let's say ... 10, 4, 7, 3, 2, 6, 5, 1, 9, 8), I'd like to use post__in to display ONLY these posts in the blogroll.

    The function I've built includes the following if/then:

    function customize_blogroll( $query )
    {
    if ( $query->is_home && $_GET['show'] == 'popular' ) {
    $popular_posts = array(10, 4, 7, 3, 2, 6, 5, 1, 9, 8);
    $query->set( 'post__in', $popular_posts );
    return $query;
    {
    }
    add_action( 'pre_get_posts', 'customize_blogroll' );

    The problem I'm faced with is a) I don't know how to stop them from being sorted and b) the output doesn't include the primary navigation menu (up top).

    I'm fiddling here. Anybody have any notes/advice on why my idea keeps breaking?


    Shabadoo!

    https://www.theridingobsession.com/articles/?show=popular
    December 25, 2017 at 8:34 am #214799
    robindean
    Member

    Alright, well ... onto StudioPress support it is.


    Shabadoo!

    December 26, 2017 at 10:34 am #214812
    robindean
    Member

    ... aaaaannnd support sent me back here.

    Seems I've mistakenly forgotten to use the term "loop" which I'll explore but my issue still remains that I'd like to display a list of very specific post ids in blogroll fashion.

    I'm going to try using the is_search page instead. Meanwhile, I'm open to suggestions.


    Shabadoo!

    December 26, 2017 at 2:22 pm #214817
    Satwinder Rathore
    Participant

    if you want to sort the posts according to the array Try this $query->set( 'orderby', 'post__in' );


    Satwinder Rathore
    https://satwinderrathore.wordpress.com

    December 26, 2017 at 2:39 pm #214820
    robindean
    Member

    In doing this, how exactly am I passing the array?

    I tried a couple of methods via the WP documentation here: https://codex.wordpress.org/Class_Reference/WP_Query

    ... but threw an error when using => in the post__in adaption.


    Shabadoo!

    December 26, 2017 at 4:38 pm #214821
    robindean
    Member

    How do I pass the array into post__in using your suggested method above?


    Shabadoo!

    December 26, 2017 at 5:10 pm #214822
    Satwinder Rathore
    Participant
    function customize_blogroll( $query )
    {
    if ( $query->is_home && $_GET['show'] == 'popular' ) {
    $popular_posts = array(10, 4, 7, 3, 2, 6, 5, 1, 9, 8);
    $query->set( 'post__in', $popular_posts );
    $query->set( 'orderby', 'post__in' );
    return $query;
    {
    }
    add_action( 'pre_get_posts', 'customize_blogroll' );

    Satwinder Rathore
    https://satwinderrathore.wordpress.com

    December 26, 2017 at 5:36 pm #214823
    robindean
    Member

    I tried this and for some reason it broke the primary navigation menu.

    I also attempted to run the same function using an is_search based GET parameter which DID show the primary nav but only returned 7 of the 10 post IDs in the array.

    Bizarre.

    At this point, it's a fun "puzzle" but I'm prepared to resort to a simple page which lists out the links.


    Shabadoo!

    December 27, 2017 at 8:33 am #214833
    robindean
    Member

    I've since abandoned my original goal and have gone with another solution. Thank you for the assistance and info.


    Shabadoo!

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Genesis (Streamline Pro) Post__In Blogroll Issues’ is closed to new 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