The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS WP: Why this code displaying all pages as category?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #37810

    Hi, i have added the below code into my products category page named as “Products” it has some child pages e.g(“Products -> Camera => (first child of Camera) Arecont (second child of Camera) Everfocus) then few more pages as child of Products only.

    It is displaying Arecont and Everfocus page as category in Products page but along with them it is also displaying other pages as well (e.g contact us, projects, clientele) which i don’t want include in my Products page. I just want to display all the child pages of Products page. Please let me know the correct way to achieve this.

    This is Products (Category) main page.

    /*Template Name: Products Category*/

    $categoriesCF = get_post_meta($post->ID, "categories", true);
    // example value = "Arecont|13,Everfocus|10"

    $allCategories = explode(",", $categoriesCF);
    // $allCategories[0] = "Arecont|13"
    // $allCategories[1] = "Everfocus|10"

    foreach ($allCategories as $category) {

    $pieces = explode("|", $category);
    // $pieces[0] = "Arecont"
    // $pieces[1] = 13

    $link = get_permalink($pieces[1]);
    echo "
    echo "

    " . $pieces[0] . "



    while (have_posts()) : the_post(); ?>

    " class="product-jump" title="ID, "product_price", true); ?>" data-large="ID, "image_1", true); ?>">

    ID, "image_1", true) . "' />"; ?>

    echo "


    This is the page where i want to display all the products of selected category.

    /*Template Name: Products Page*/

    • " />

    Please help me.

Viewing 1 post (of 1 total)
  • The forum ‘CSS’ is closed to new topics and replies.