WordPress.org

Forums

Vantage
Display Post from a Category - NO Plugins! (2 posts)

  1. Jake.
    Member
    Posted 8 months ago #

    Hi, I want to display all the posts from a particular category. I have copied the default 'Blog' template and opened it up. This is whats inside.

    if( !get_option( 'page_for_posts' ) && get_option( 'show_on_front' ) == 'page' && get_post_status() == 'publish' ) {
    // We're transitioning away from using the blog page template
    // Automatically update this so it uses the proper system.
    update_option( 'page_for_posts', get_the_ID() );
    update_post_meta( get_the_ID(), '_wp_page_template', 'default' );
    }

    add_filter('option_show_on_front', '__return_false');
    add_filter('siteorigin_panels_is_home', '__return_false');
    global $wp_query;
    query_posts(array(
    'paged' => $wp_query->get('paged'),
    ));
    global $more; $more = 0;
    get_template_part('index');
    $more = 1;
    remove_filter('option_show_on_front', '__return_false');
    remove_filter('siteorigin_panels_is_home', '__return_false');

    wp_reset_query();
    wp_reset_postdata();

    I'm trying to locate the part which selects the category but I cant seem to find it. Can anyone give me a hand?

    THanks

  2. Jake.
    Member
    Posted 8 months ago #

    Solved it, just had to add 'cat' => '#' to the array

Reply

You must log in to post.

About this Theme

About this Topic