[Resolved] Need Separate Page For Blog Post Category

Home Forums Support [Resolved] Need Separate Page For Blog Post Category

Home Forums Support Need Separate Page For Blog Post Category

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #642063
    Sean

    Hi,

    I have a separate link and page for the blog posts categorised as “Real Brides”, how do I edit this so that the “real brides” posts showing on the blog page are moved to the “Real Brides” page and also keep it like this for future posts?

    Thanks,
    Sean

    GeneratePress 2.1.3
    #642077
    Leo
    Staff
    Customer Support

    Hi there,

    If I understand you correctly, Tom’s WP Show Posts should help:
    https://en-ca.wordpress.org/plugins/wp-show-posts/

    Let me know if this helps πŸ™‚

    #642967
    Sean

    Thanks Leo, I installed i’m not sure if it is the solution I require. The main issue I want to remove the “Real Brides” posts from the blog whilst keeping them on the “Real Brides” page/blog.

    Hope that makes sense!

    #643002
    Stefan Hampel

    Hi,
    if I’m getting you right you like to hide posts from the blog. I do this with a function (see below).

    1.Find out the Category Id of “Real Brides” and add it to the function below where it says “ID HERE”(keep the -).
    2.Add the function to your functions.php file (with child theme or plugin)
    3.Save and refresh the browser page of the blog.

    function exclude_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'cat', '-ID HERE' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );

    Hope that helps!

    #643724
    Sean

    Thanks Stefan, all working now!

    #643838
    Stefan Hampel

    You’re welcome! πŸ™‚

    #644168
    Leo
    Staff
    Customer Support

    Thanks Stefan πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.