• I’ve developed a site with a lot of post categories. I need to display some categories differently. Most will be a grid with img etc. but for the category LINKS, they will just be a list of post titles.

    I have LINKS -> Support, LINKS -> Resources etc. so many child categories of LINKS.

    I copied category.php to category-links.php and changed ONLY the layout, not the loop. It seemed to work, but while I got NEXT and PREVIOUS buttons (so it seemed to find posts and page thru them) no posts were displayed on the screen. Even when I only copied the file and made no changes, it would not actually display anything.

    What is the right way to create a custom ‘category-links’ so that it applies to the root LINKS, and to all children of that category?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you please share your link and your code (using pastebin)

    Thread Starter digitalsmithy

    (@digitalsmithy)

    Ah well (no paste bin acc) here’s the template part again:

    <section>
        <div class="col-md-12">
            <?php if ( have_posts() ) : ?>
                <?php $item_number = 0; ?>
                <?php while ( have_posts() ) : the_post(); ?>
                    <div class="col-md-4">
                        <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
                            <a href="<?php echo esc_url( the_permalink() ); ?>"><h3 class="nicein niceout nicem"><?php the_title(); ?></h3></a>
                            <a href="<?php echo esc_url( the_permalink() ); ?>"><?php
                                    if ( has_post_thumbnail() ) {
                                        the_post_thumbnail( 'arch-img', array(
                                        'class' => 'nicein niceout nicem'
                                    ) );
                                    }
                                 ?></a>
                            <?php the_excerpt( ); ?>
                        </article>
                    </div>
                    <?php $item_number++; ?>
                    <?php if( $item_number % 3 == 0 ) echo '<div class="clearfix visible-md-block visible-lg-block"></div>'; ?>
                <?php endwhile; ?>
            <?php else : ?>
                <p><?php _e( 'Sorry, no posts matched your criteria.', 'RecoveryDevTheme' ); ?></p>
            <?php endif; ?>
        </div>
        <div class="row pg-empty-placeholder"></div>
    </section>
    Thread Starter digitalsmithy

    (@digitalsmithy)

    Well, I feel pretty stupid. I just copied category.php to category-links.php so I could show you it breaking… and it works fine.

    I spent hours unable to make it work so I’m totally baffled, and apologise for wasting your time – but as I say, it seems to have magically fixed itself.

    Thanks for your efforts.

    Great Cheers 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Category Archive Pages’ is closed to new replies.