• 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

Using pre_get_posts to call postID

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 › Using pre_get_posts to call postID

This topic is: not resolved

Tagged: postif, pre_get_posts, sticky

  • This topic has 4 replies, 2 voices, and was last updated 11 years, 11 months ago by Silver007A.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 22, 2013 at 9:31 am #51836
    Silver007A
    Member

    Hi,

    I'm using eleven40 theme and have a problem with extra posts appearing on my home page even if I use the featured post plugin, set 7 posts in Setting- Reading and set posts as "sticky" I seem to get my 7 sticky posts plus 3 extras that I don't want to appear.

    It's been suggested I use pre_get_posts to call the postID instead of using the sticky option, however, I have to confess I am completely at a loss.

    Would someone be good enough to help me with the code to select the 7 posts that I want to appear on my home page please.

    Thanks for any help,

    🙂

    http://www.virtualglobal.co.uk/
    July 22, 2013 at 10:58 am #51853
    Brad Dalton
    Participant

    You can modify the number of featured posts in the home.php file

    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'eleven40_grid_loop_helper' );
    /** Add support for Genesis Grid Loop */
    function eleven40_grid_loop_helper() {
    
    	if ( function_exists( 'genesis_grid_loop' ) ) {
    		genesis_grid_loop( array(
    			'features' => 1,
    			'feature_image_size' => 0,
    			'feature_image_class' => 'alignleft post-image',
    			'feature_content_limit' => 0,
    			'grid_image_size'		=> 'grid-thumbnail',
    			'grid_image_class'		=> 'alignnone',
    			'grid_content_limit' => 250,
    			'more' => __( '[Continue reading]', 'genesis' ),
    		) );
    	} else {
    		genesis_standard_loop();
    	}
    
    }
    
    genesis();
    

    Tutorials for StudioPress Themes.

    July 22, 2013 at 11:36 am #51863
    Silver007A
    Member

    Thanks for the help braddalton, but that didn't seem to work. It stripped the columns that eleven40 creates on teh home page, the read more and still showed 3 extra posts that aren't sticky posts.

    If anyone can help i would really appreciate it.

    Thanks,

    🙂

    July 22, 2013 at 11:51 am #51864
    Brad Dalton
    Participant

    You'd need to modify the values in that code so you get 7 features and then make them sticky. You would also need to match your reading settings so only 7 display.

    You can't display 7 posts as sticky in a grid unless you modify the code. What you can do is display 7 featured posts as sticky but not in a grid.

    Another option is to add styling to your home page posts so they look the same as what they do when they're sticky.


    Tutorials for StudioPress Themes.

    July 23, 2013 at 12:35 pm #52114
    Silver007A
    Member

    Studiopress tech supp have advised me this-

    If you don't want pagination then I would recommend picking via postID and not using sticky posts. You will have to use the pre_get_posts action to modify the query.

    Here is a tutorial on pre_get_posts
    http://www.billerickson.net/customize-the-wordpress-query/

    However, I don't understand the tutorial enough to know where to call the postID.

    I don't know php that well I'm afraid.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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