WordPress.org

Ready to get started?Download WordPress

Forums

Why is same CSS inside same php file is enforced 2 different ways? (5 posts)

  1. ajs
    Member
    Posted 8 years ago #

    I do not have an archive.php page, so my index.php doubles as the archive template. Also, I created a search.php page that is identical to the index.php except it says "Search Results.." at the top.

    My question is that the index.php page enforces the <div class="entry entry-1" while when called as an archive, or when duplicated in search.php, this <div> class does nothing, yet I can remove the class call altogether and it clearly effects the format, so somehow there is something going on in the php code to tell the page that it is indeed an index only that is being called to enact the <div> class:

    <?php get_header(); ?>
    <div id="content">
    <?php if (have_posts()) :?>
    <?php $postCount=0; ?>
    <?php while (have_posts()) : the_post();?>
    <?php $postCount++;?>
    <div class="entry entry-1">
    <div class="entrytitle">

    Any idea why that <div class="entry entry-1"> only actually shows the class when viewed as an index? The archive page understands and utilizes all the postCount stuff too, just doesn't behave the "entry entry-1" class. Very confused on this one.

  2. Ryan Fitzer
    Member
    Posted 8 years ago #

    Have you looked in header.php for any conditional statements?

  3. ajs
    Member
    Posted 8 years ago #

    ah, didn't think to check there. i found this:

    <body <?php if(is_home()){echo 'id="home"';}?>>

    which perhaps would have an effect on a <div> inside the <body>.. ?

    also found this, before the above code:

    <?php wp_head(); ?>

    any idea what that command does?

  4. ajs
    Member
    Posted 8 years ago #

    ah, indeed, my styles says:

    body#home .entry-1

    so that explains it! another question resolved! thanks!

  5. yosemite
    Member
    Posted 8 years ago #

    Perhaps you can mark it resolved, then?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags