WordPress.org

Ready to get started?Download WordPress

Forums

Posts from categories on pages (1 post)

  1. rolph
    Member
    Posted 5 years ago #

    Hi!

    Please help me, I made 3 pages and 3 subpages:
    -About
    - News
    -- My news
    -- News from the Internet
    -- Blogs
    - Contacts

    and 3 categories for news.

    How to prevent news of the categories reflect on the relevant pages?

    Now I realized this is so:
    <? php if (is_page (6)) (query_posts ( "cat = 6");)?>
    ...

    But after this, subpages in sidebar is disappear.

    Now i think, maybe, I did something wrong?

    PS: Part for subpages in submenu:
    global $notfound;
    if (is_page() and ($notfound != '1')) {
    $current_page = $post->ID;
    while($current_page) {
    $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
    $current_page = $page_query->post_parent;
    }
    $parent_id = $page_query->ID;
    $parent_title = $page_query->post_title;

    if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_type != 'attachment'")) {
    ?>
    <li class="widget">
    <h2><?php echo $parent_title; ?> <?php _e('Subpages'); ?></h2>
    <ul class="list-page">
    <?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?>

    <?php } } ?>
    But after that ceased to affect the internal pages in the left menu

Topic Closed

This topic has been closed to new replies.

About this Topic