Alex Selejan
asked 5 years ago

I have edited category.php a bit in order not to call for the row-fluid content bar. My code now for category.php looks like below. However for some reason on some category pages it works and othe category pages do no seem to access the file.
P.S. I have made sure that I do not have any template files of category-id or category-slug nature.
Any ideas on the subject ?
Thank you 🙂

`get_header(); ?>
<div id="primary" class="site-content span9">
<?php echo category_description(); ?>

     <div class="content-inner <?php echo 'layout-'.apply_filters( 'cat_display_filter', dw_get_option('cat_display')), 'grid'; ?>">
    <?php if ( have_posts() ) : ?>
        <?php global $archive_i; $archive_i = 1 ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part('content', 'archive'); ?>
            <?php $archive_i++; ?>
        <?php endwhile; ?>
    <?php endif; ?>
    </div>
    <?php 
        dw_focus_pagenavi();
        wp_reset_query();
    ?>
</div>

<?php get_sidebar( ‘archive’ ); ?>
<?php get_footer(); ?>`

1 Answers
DominicStaff
answered 5 years ago

Hi,
If you want to remove the Categories title bar in categories page and instead with the Categories Description, you can use the following code:

<?php
/**
 * The template for displaying category pages.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 */

get_header(); ?>
    <div id="primary" class="site-content span9">
        <div class="content-bar categories-description-bar row-fluid">
            <?php echo category_description(); ?>
        </div>
        <div class="content-inner <?php echo 'layout-'.apply_filters( 'cat_display_filter', dw_get_option('cat_display')); ?>">
        <?php if ( have_posts() ) : ?>
            <?php global $archive_i; $archive_i = 1 ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <?php get_template_part('content', 'archive'); ?>
                <?php $archive_i++; ?>
            <?php endwhile; ?>
        <?php endif; ?>
        </div>
        <?php 
            dw_focus_pagenavi();
            wp_reset_query();
        ?>
    </div>
<?php get_sidebar( 'archive' ); ?>
<?php get_footer(); ?>

Then add the following code to the style.css file:

.categories-description-bar {
    background: #000;
    height: 130px;
    line-height: 20px;
}
.categories-description-bar p {
  padding: 20px;
}

Hope this helps !

selejanalex
replied 5 years ago

Thank you for your response. This helps to a certain extent. I have just removed the div surrounding category_description(), as it interfered a bit with other elements from the site. But for some reason, the category template still does not apply to all the categories. So I am getting randomly category pages with either a list or a category view. Any thoughts ?

dominic Staff
replied 5 years ago

You can log in to Dashboard > Customize > Archive Settings, then select the default archive pages display layout.
See the screenshot: http://prntscr.com/8dj10n

selejanalex
replied 5 years ago

Thank you!

Powered by DW Question & Answer Pro