WordPress.org

Ready to get started?Download WordPress

Forums

[NSFW] - Layout issues (5 posts)

  1. user256
    Member
    Posted 1 year ago #

    I'm currently working on a NSFW rampant rabbit Site, the idea is to have the archive page responsive and looking somewhat like the home page. Unfortunatly I can't work out why the page is staggering the first row.

    Can anyone advise where i'm going wrong.

    cheers!

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    You added your width & float to the wrong element. Try <article>.

  3. user256
    Member
    Posted 1 year ago #

    Amazing thank you, alas this now brings me back to a problem i had on a previous theme but couldn't get help with (hence my rebuilding in 2012)

    For some reason the page is leaving blank spaces where i would normally expect the next post to appear. Any idea why?

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    That happens when some elements are taller than others.

    The proper way to resolve this is to wrap each row of items in a <div>, in your case it'll be for every 3 items.

    You could otherwise try adding "min-height" to the posts or a really bad way would be to add a "height". "height" is really bad because it cuts off text when people resize the text larger.

  5. user256
    Member
    Posted 1 year ago #

    Hey again, Sorry to be such a pain but i've been at this for ages and i'm getting nowhere.

    As i understand it you're telling me i need to set a count like this to place a div around every three posts

    I can't seem to make this work so i'm inserting the template i'm using in the hope you can advise what i should be doing.

    <?php
    /**
    * The template for displaying Archive pages.
    *
    * Used to display archive-type pages if nothing more specific matches a query.
    * For example, puts together date-based pages if no date.php file exists.
    *
    * If you'd like to further customize these archive views, you may create a
    * new template file for each specific one. For example, Twenty Twelve already
    * has tag.php for Tag archives, category.php for Category archives, and
    * author.php for Author archives.
    *
    * Learn more: http://codex.wordpress.org/Template_Hierarchy
    *
    * @package WordPress
    * @subpackage Twenty_Twelve
    * @since Twenty Twelve 1.0
    */

    get_header(); ?>
    <section id="primary" class="site-content">
    <div id="content" role="main">

    <?php
    /* Display All Posts */

    /* Display All Posts */
    if ( have_posts() ) : ?>
    <header class="archive-header">
    <h1 class="archive-title"></h1>
    </header><!-- .archive-header -->

    <?php
    global $query_string;
    query_posts( $query_string . '&posts_per_page=-1' );
    $count = 0;
    if(have_posts()) : while(have_posts()) : the_post();
    if ($count < count($posts)) {
    $open = !($count%2) ? '<div class="work-row">' : '';
    $close = !($count%2) && $count ? '</div>' : '';
    } else {
    $open = '<div class="work-row">';
    $close = '';
    }

    echo $close.$open;
    ?>
    <div id="posts"><article>

    <h3 class="entry-title">"><?php the_title(); ?></h3>
    <?php the_post_thumbnail('excerpt-thumbnail'); ?>

    <div><?php the_excerpt(); ?></div>
    <?php the_field( "affiliate"); ?><?php the_field( "more"); ?>

    </article></div>

    <?php
    $count++;
    endwhile; endif; ?>
    <?php echo $count ? '</div>' : '';
    twentytwelve_content_nav( 'nav-below' );
    ?>

    <?php else : ?>
    <?php get_template_part( 'contented', 'none' ); ?>
    <?php endif; ?>

    </div><!-- #content -->
    </section><!-- #primary -->

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thanks in Advance

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.