• 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

Feature Post above the Blog listing

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 › Feature Post above the Blog listing

This topic is: resolved

Tagged: blog listing, Feature Blog Entry

  • This topic has 13 replies, 2 voices, and was last updated 12 years, 10 months ago by Brad Dalton.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • June 11, 2013 at 9:15 am #45258
    csbeck
    Member

    I am recreating a blog section from a pre-existing blog. The original blog has a single featured blog post above the listing of the rest of the blog postings on the blog list page.

    Existing Site: http://www.virtualworks.com/blog/

    New Site: http://acquireb2bdev.com/blog

    You'll see that on the existing site there's a blog posting "How is VirtualWorks establishing a new category?" - this is a featured post and is displayed at the top of the page. It's still there when I view older posts. It's above the listing of the rest of the posts (post loop).

    So is there a way that perhaps I could create a new Category and call it Featured and then have the Blog listing page show the Featured post(s) above the rest of the list?

    I tried searching for this topic but didn't find relevant topics.

    Thanks so much! Chris

     

     

    June 11, 2013 at 9:17 am #45259
    csbeck
    Member

    BTW - the existing site used a plugin called "Yet Another Featured Posts Plugin" but I'm wondering if it can be done by just hooking a little bit of code.

    June 11, 2013 at 9:25 am #45263
    Brad Dalton
    Participant

    New widget area would be the best because you can drag in the Genesis featured post widget:

    Code not displaying? grab it on Github.

    You could also use the page template conditional:

    if (is_page_template('blog.php') ) { 
    

    Even added a curly bracket for you because i know how much you love them Chris!!


    Tutorials for StudioPress Themes.

    June 11, 2013 at 9:42 am #45266
    csbeck
    Member

    Hey, Brad to the rescue again! And look, you put in the curly brackets! You're so kind.

    This works like a charm - as expected - except it's not in the right place exactly. Can you help again by helping figure out what hook to put it in? I thought it should have been the before the loop as you did it, but the title of the page is coming within the loop. Strange. I must be making a mess of things.

    Thanks so much for your continued support!

    June 11, 2013 at 9:54 am #45274
    Brad Dalton
    Participant

    What theme are you using?

    If you're running HTML 5, the loop hooks have changed. http://www.briangardner.com/code/genesis-html5-loop-hooks/


    Tutorials for StudioPress Themes.

    June 11, 2013 at 9:54 am #45275
    csbeck
    Member

    Agency. Sorry for not including that.

    June 11, 2013 at 9:59 am #45281
    Brad Dalton
    Participant

    Try changing

    genesis_before_loop
    

    to

    genesis_before_entry
    

    if its a HTML 5 enabled child theme. Otherwise you may need to change the conditional tag.


    Tutorials for StudioPress Themes.

    June 11, 2013 at 10:02 am #45283
    csbeck
    Member

    Thanks. It disappeared.

    So that didn't work. Bummer.

    June 11, 2013 at 10:21 am #45293
    Brad Dalton
    Participant

    This is what i used and it worked:

    add_action( 'genesis_before_loop', 'wpsites_before_blog_widget', 5 );
    function wpsites_before_blog_widget() {
    if ( is_page('11465') ) {
    echo '<div class="before-blog">';
    	dynamic_sidebar( 'before-blog' );
    	echo '</div><!-- end .before-blog -->';
    
    	}
    
    }
    

    I used the page-id from the source code and running XHTML


    Tutorials for StudioPress Themes.

    June 11, 2013 at 10:28 am #45295
    csbeck
    Member

    Thanks. I used your exact code and put in my id (69) and it shows up but above the title area still.

    Perhaps this issue is being generated by me using the Genesis Simple Hooks. I needed to create a section for the title and subtitle (together) that needed to not affect the content location below. So I added a special div for the Title and Subtitles. So in the hooks I did the following:

    `genesis_before_post_title`:
    <div class="page-title-container">
    `genesis_before_post_content`:
    </div> <!-- end page-title-container -->

    So perhaps this might be messing with our attempt to add the widget below the title.

    If I were to add some PHP code (your function from above) in that hook with the end div, what would the code be?

    Also, just for my knowledge, what is the number "5" for in your code above? The earlier code had a "9".

    June 11, 2013 at 10:42 am #45297
    csbeck
    Member

    Getting close. I changed the action to say:

    `add_action( 'genesis_after_post_title', 'wpsites_before_blog_widget', 5 );`

    Now I just have to push the loop content down. I thought I'd use "display: block;" but that's not doing it. Any thoughts?

     

    June 11, 2013 at 10:47 am #45299
    Brad Dalton
    Participant

    5 is the third parameter for positioning. The default is 10 so you can add 5 if you want to hook content in before a function using the same hook as long as its a number below what the function uses.

    But it can also depend on where the function is in the file also. If there's 2 functions using the same hook and both aren't using the third parameter, the one highest in the file gets priority positioning.

    I tried simple hooks with your code and it makes no difference. The widget outputs the content before the posts which is what you want isn't it?

    Must be something else.

    I would never change any of the defaults like that because then you can start to cause big problems.


    Tutorials for StudioPress Themes.

    June 11, 2013 at 11:12 am #45304
    csbeck
    Member

    Yes it is what I want. What defaults are you referring to that I shouldn't change?

    I think I've got it working correctly now. There was a style that was making the area a set height.

    Thanks so much for you sticking with me through this!

    June 11, 2013 at 11:33 am #45308
    Brad Dalton
    Participant

    Goof stuff.

    Referring to the page-title-container.

    When i changed the hook it didn't display for me.


    Tutorials for StudioPress Themes.

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

© 2026 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