Support » Themes and Templates » New div from new function not picking up css styling

  • Resolved wperic


    I’m trying to develop a new function for my child theme (based on veryplaintxt). The function will add some graphics to the categories archive page, to float:right next to the category description and the post excerpts. The function seems to be working right, the right code shows up in the page source, but for some reason it’s not picking up the css styling for #category_art.

    This is the function:

    function category_art() {
        echo '<div id="category_art">';
        echo "This is category_art div.";
       echo "</div> <!-- div#category_art -->";

    The function seems to be working fine.

    This is the css entry in style.css for my child theme:

    /* styling for art work on the various category (topics) archive pages */
    #category_art {
      border: solid black 2px;

    This is where I’ve inserted the function in archive.php in my child theme:

    <?php elseif ( is_category() ) : ?>
    			<h2 class="page-title"><?php _e('Topic Archives:', 'veryplaintxt') ?> <span class="page-cat"><?php echo single_cat_title(); ?></span></h2>
                            <?php category_art(); ?>
    			<div class="archive-meta"><?php if ( !(''== category_description()) ) : echo apply_filters('archive_meta', category_description()); endif; ?></div>
    <?php elseif ( is_tag() ) : ?>

    This is how the source code comes out when I visit the page:

    <!--changed 'Category Archives' to 'Topic Archives' at 'elseif (is_category()'-->
    	<div id="container">
    		<div id="content" class="hfeed">
    			<h2 class="page-title">Topic Archives: <span class="page-cat">the human person</span></h2>
                            <div id="category_art">This is category_art div.</div> <!-- div#category_art -->

    So WP is generating html that calls the styling for the div with ID #category_art, but it’s not showing the styling. All I get is a plain line of text “This is category_art div.” left-justified between the “Category Archives” heading and the category description.

    When I inspect the element with Firebug all is shows is styling inherited from “body.”

    What am I missing?


Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Andrew Nevins


    Forum moderator

    None of the CSS are applying?

    Everything else is styling fine. It’s just the styling for #category_art that’s not applying.

    Moderator Andrew Nevins


    Forum moderator

    Can you link your page relevant, or the HTML and CSS of one relevant page?

    Hold the press. I think I see what I did–forgot the “id= ” bit.

    Duh! Sorry.



    Forum Moderator

    assume that style.css is broken somewhere before your new styles;

    try and move the new styles to the top of style.css

    No. That’s not it. I was looking in the wrong place.

    @alchymyth: will try that.



    Forum Moderator

    this would take only a few seconds to check with a link to the problem.

    Nope. That didn’t make any difference.

    The site is not public yet. I just set up a pastebin acct. Should I post the entire child theme style.css and the resultant page code (html) for one of the category archive pages?

    Curioser and curioser.

    I just had to reboot my computer and when I restarted Firefox and went back to the site, it was formatted correctly.

    Whatever. WP usually seems to do a good job of updating and not getting hung up by what’s in the cache, but maybe something like that happened this time.

    Also, mimicing some other divs in the neighborhood I had changed the css heading for this id to “div#content div#category_art.” I don’t know why that would make a difference, given my understanding of how IDs work in css.

    Thanks to all.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘New div from new function not picking up css styling’ is closed to new replies.