• Resolved Toeps

    (@toeps)


    Hi!

    I’m trying to “hack” this for days now… We have the new WordPress 3.8 running ( on https://www.fashionmilk.com ) and I would like the featured posts in the grid to be shown on the front page as normal posts as well.

    I found that the posts are excluded in a .php-file at inc/featured-posts.php
    So I even deleted that whole piece of code (the piece below “Exclude featured posts from the home page blog query”). I know that’s not the right way to do it, but to my surprise even without this code, the posts aren’t showing up! I’m confused… Is there some kind of cache? Am I missing a piece of code?

    Wouldn’t it be easier to make users choose, just as we can choose the featured tag to be visible or not? Just another option like: “Show/hide posts in the grid/slider on the front page” I know the posts are basically doubled then, but our readers might miss out on posts that are only visible in the featured area.

    Can anyone tell me how I can do this for now? Tnx!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I see that you have copied the featured-posts.php file from the parent theme to your child theme and have edited it.

    This isn’t working because the parent theme is programmed to “include” this file only from its own directory. The last few lines of functions.php

    if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
    	require get_template_directory() . '/inc/featured-content.php';
    }

    The get_template_directory() function returns the absolute path of the parent theme.

    Now to solve your problem edit the wp-content/themes/twentyfourteen-child/functions.php file and place the following code.

    add_action( 'init', 'show_featured_content_on_home', 31 );
    
    function show_featured_content_on_home()
    {
    remove_action( 'pre_get_posts', array( 'Featured_Content', 'pre_get_posts' ) );
    }
    Ben Meredith

    (@benmeredithgmailcom)

    So, you are looking to put posts in the grid and then immediately below the grid as well?

    Off the top of my head, you’d want to disable the grid in the settings, and then figure out a way (perhaps a plugin?) to add a featured box at the top of the page with the most recent posts featured.

    The short answer is that you are trying to modify what is called the “loop” which is a core piece of how WordPress delivers content, and you don’t want to do that. Using a plugin will give you much better results.

    Let me know if that doesn’t make sense!

    Thread Starter Toeps

    (@toeps)

    OMG Jesin A, THANKS SO MUCH! It works!

    And yes, Ben, I wans to put posts in the grid and below ??
    Our readers are used to all the posts on the home page blog, the grid is just an extra thing. We used to have a slider before that worked just like that. I don’t want to disable the grid, I just wanted to disable the function that then hides the posts from the “normal” site query ??

    You’re welcome. Great to hear that!!!

    I think I am having the exact same issue. This is the link to my open request for help.

    https://www.ads-software.com/support/topic/featured-articles-missing-on-front-page?replies=3

    I have WordPress 3.9.1 twenty fourteen theme.

    My featured article posts have disappeared from my front page in a manner similar to the first poster but I am hopelessly illiterate at code and such. Can you give me a little more guidance on how to use that code to fix my problem?

    I found it and it worked!! Here it is for anyone who is as bad as me.

    Appearance > Editor > look on far right for functions.php > copy and paste the code at the bottom.

    Thanks for helping Toeps, Jesin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Don't exclude featured posts from front page query’ is closed to new replies.