WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] New div from new function not picking up css styling (12 posts)

  1. wperic
    Member
    Posted 1 year ago #

    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 {
     margin:3px;
      padding:3px;
      float:right;
      height:300px;
      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?

    Thanks
    wperic

  2. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    None of the CSS are applying?

  3. wperic
    Member
    Posted 1 year ago #

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

  4. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

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

  5. wperic
    Member
    Posted 1 year ago #

    Hold the press. I think I see what I did--forgot the "id= " bit.

    Duh! Sorry.

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

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

  7. wperic
    Member
    Posted 1 year ago #

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

  8. wperic
    Member
    Posted 1 year ago #

    @alchymyth: will try that.
    thanks.

  9. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

  10. wperic
    Member
    Posted 1 year ago #

    Nope. That didn't make any difference.

  11. wperic
    Member
    Posted 1 year ago #

    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?

  12. wperic
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.