Skip to content

Instantly share code, notes, and snippets.

@lluisgerard
Created October 26, 2011 11:29

Revisions

  1. lluisgerard revised this gist Oct 26, 2011. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.aw
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,8 @@ if( $cat_obj->parent ) {
    // CATEGORIA PARE / Parent category only
    while ( have_posts() ) : the_post(); ?>
    <?php
    // Controlem que sempre sigui una categoria pare / a parent has no parent

    // Controlem que sempre sigui una categoria pare / a parent has no parent
    $category = get_the_category();
    if ($category[0]->category_parent == 0) : ?>

  2. lluisgerard revised this gist Oct 26, 2011. 1 changed file with 15 additions and 13 deletions.
    28 changes: 15 additions & 13 deletions gistfile1.aw
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,28 @@
    <?php $cat_obj = $wp_query->get_queried_object(); ?>
    <?php if( $cat_obj->parent ) { ?>

    <?php // CATEGORIA FILL / Child category only
    while ( have_posts() ) : the_post(); ?>
    <?php
    if( $cat_obj->parent ) {
    // CATEGORIA FILL / Child category only
    while ( have_posts() ) : the_post(); ?>

    <?php include('post.php'); ?>
    <?php include('post.php'); ?>

    <?php endwhile; ?>

    <?php endwhile; ?>
    <?php } else { ?>

    <?php // CATEGORIA PARE / Parent category only
    while ( have_posts() ) : the_post(); ?>

    <?php // Controlem que sempre sigui una categoria pare / a parent has no parent
    $category = get_the_category();
    if ($category[0]->category_parent == 0) : ?>
    <?php
    // CATEGORIA PARE / Parent category only
    while ( have_posts() ) : the_post(); ?>
    <?php
    // Controlem que sempre sigui una categoria pare / a parent has no parent
    $category = get_the_category();
    if ($category[0]->category_parent == 0) : ?>

    <?php include('post.php'); ?>

    <?php endif; ?>

    <?php endwhile; ?>
    <?php endwhile; ?>

    <?php } ?>
  3. lluisgerard created this gist Oct 26, 2011.
    26 changes: 26 additions & 0 deletions gistfile1.aw
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <?php $cat_obj = $wp_query->get_queried_object(); ?>
    <?php if( $cat_obj->parent ) { ?>

    <?php // CATEGORIA FILL / Child category only
    while ( have_posts() ) : the_post(); ?>

    <?php include('post.php'); ?>

    <?php endwhile; ?>

    <?php } else { ?>

    <?php // CATEGORIA PARE / Parent category only
    while ( have_posts() ) : the_post(); ?>

    <?php // Controlem que sempre sigui una categoria pare / a parent has no parent
    $category = get_the_category();
    if ($category[0]->category_parent == 0) : ?>

    <?php include('post.php'); ?>

    <?php endif; ?>

    <?php endwhile; ?>

    <?php } ?>