WordPress.org

Ready to get started?Download WordPress

Forums

Category in a box with css overflow scroll, but loop repeats boxes. (11 posts)

  1. riyota
    Member
    Posted 2 years ago #

    I'm making a page with a unique homepage, on this unique homepage I'm only showing one category. I want to show it in a small box, with scrolling (done with css). But the loop, (because it's a loop) repeats the box for each post. I wan't all the post to be in the box. I'm thinking that I have to wrap the loop somehow and style that wrap with css? Is there anyone who can point me in the right direction. Can't find the solution within the codex, but it should be in there somewhere. Or if you know or have suggestions how to solve this it would be much appreciated.

    Working on my first WP page.

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    please post a link to your site to illustrate the problem;

    if you would like someone to have a look, you can paste the full code of your template into a http://pastebin.com/ and post the link to it here - see forum guidelines

  3. riyota
    Member
    Posted 2 years ago #

    alchymyth Thanks for the answer.

    Heres a link to a screen image of the top of my Front page and the bottom. The problem is visible at the bottom.

    Top

    bottom

    Link to my css

    Link to my home.php

    I hope someone can help me... And the Css is a bit cluttered and home.php file contains some elements I'm still thinking about what to do with.

  4. riyota
    Member
    Posted 2 years ago #

    Me again sorry I forgot to mention that the container for the information box
    is on row 204 #info-container.

  5. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    try to move the #info-container div to the outside of the loop;

    example edited home.php:
    http://pastebin.com/LRpuGFdR

  6. riyota
    Member
    Posted 2 years ago #

    alchymyth thanks again for a fast reply.
    I tried to do that, what happens is that only the top post is in the box, the box is not repeated but the other post are below the image of the front page.

    Image link

  7. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    please pastebin the code of your template home.php as it is now.

  8. riyota
    Member
    Posted 2 years ago #

    Thanks again, here is the code as it is now.

    http://pastebin.com/JVAtLAfY

  9. riyota
    Member
    Posted 2 years ago #

    alchymyth I thoulght I solved it by putting in a query after "<?php while (have_posts()) : the_post(); ?>"

    <?php query_posts("posts_per_page=6");the_post();?>

    but it seems that it endlessly repeats the loop in the box.
    and the footer disapears. But maybe I'm moving in the right direction?

    http://pastebin.com/c6nC1bUC

  10. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    remove this:

    <? wp_reset_query();?>
                                                    <?php query_posts("posts_per_page=6");the_post();?>

    if you want to restrict the number of posts, possibly change this:

    query_posts('&cat=4');

    to:

    query_posts('cat=4&posts_per_page=6&paged='.get_query_var('paged'));

    and remove this from line 32:

    <? wp_reset_query();?>

    it still does not explain why the posts are running out of the container - unless there is some odd stuff in '/inc/meta.php'

    it would help to check these things if you can post a live link to your site.

  11. riyota
    Member
    Posted 2 years ago #

    Thank you again alchymyth. Sorry for my late reply, I have been mobile and not working on the site for the last two weeks.

    I don't have a live site so I can't post a link to my site. It's on my computer on a local server.

    The present page is on a server with a drupal set up. But maybe it's possible for me to set up my wordpress site as well?

    The meta.php looks like this.

    <div class="meta">
    	<em>Posted on:</em> <?php the_time('F jS, Y') ?>
    	<em>by</em> <?php the_author() ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.