Custom class for a category page (4 posts)

  1. gabsej
    Posted 1 year ago #


    First of all, thank you for this nice and goodlooking template.

    I just wanted to customize a category.
    I created a file for this category "category-8"
    I modified my loop like beelow :

    <?php /* The loop */ ?>
    					<?php while ( have_posts() ) : the_post(); ?>
    					<div class="box_gs">
    						<a href="<?php the_permalink() ?>" rel="bookmark"></a>
    						<h2><?php the_title(); ?></h2>
    						<?php if (has_post_thumbnail()) {the_post_thumbnail('thumbnail');}?>
    						<?php the_excerpt(); ?>
    					<?php endwhile; ?>
    					<?php suits_paging_nav(); ?>
    					<?php endif; ?>

    I modified my css in "style" like beelow :

    .box_gs {
    	width: 620px;
    	margin:0 10px 10px 0;
    	border-bottom-color: lightgrey;
    	border-bottom-style: solid;
    	border-bottom-width: 1px;
    .box_gs img {
    float: left;
    margin: 0 10px 0 0;
    width : 80px;
    border-radius: 5px;
    .box_gs h2 {
    .box_gs a {
    color: black;
    .box_gs:hover {
    background: lightgrey;
    .box_gs .link  a{
    .archive-gs {
    	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    	margin-bottom: 20px;

    Using Firebug I can see that the div exist but the css doesn't apply.

    What did I miss ?
    Is their something in "functions" or "content" ?

    Thank you very much for your help.

  2. Balint Toth
    Posted 1 year ago #


    Could you please share a link to your site so I could take a look?

    Just as a friendly advice, you should never make any changes to your theme's files. The best practice is to create a child theme, because this ensures that your modifications are not deleted when you update your theme or WordPress.

    [signature removed per forum etiquette]

  3. gabsej
    Posted 1 year ago #


    Thank you for your answer.
    I can't bring ou a link to the website, it's on "maintenance" I stille have to create the content and to finish to define the layouts.

    You are right for the child layout, I did it but I will take attention to details, from what I red the "functions.php" file is working differently.
    It wasn't too dangerous because my theme was working using "archives.php" I created a "category.php" to see my changes (and a copy for myself of 'style.css, you are right, that's not the best way).

    I found a trick to apply my modifications : I used "custom css" from the jetpack plugin but I'm still trying to understant why it doesn't work by the other way.
    No idea !?

  4. Balint Toth
    Posted 1 year ago #

    That is a good way to apply css code also, but it applies to the page differently from when you paste it in the style.css (usually the css code from Jetpack's plugin is linked last, so usually it has the highest priority)

    I think some of the code is being overwritten by something, but it is really hard to tell without seeing what happens (I use FireBug too :-) ). It may be some plugin, or some code of the theme that is interfering with your modifications.

    You should check if in the header.php file the <body> tag looks something like this:

    <body <?php body_class(); ?>>

    This will output some extra CSS IDs and classes to the body tag, which helps you create css code that applies only to specific pages.

    Please let me know how you manage.

    Toth Balint BT [that is my username. What's wrong with that?]

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic