Support » Fixing WordPress » How to make list item in 3 column and 2 row

  • Hello!

    i want to change my cms into wordpress and i get stuck with list item
    I have use some loop to pull out post on my home page and put it into ul list
    But my columns are still in just one and i want to be it 3 and two row
    I have made some styling with css but nothing works
    Can anybody help me and find where problem is

    My old cms is : http://www.pvcstolarija.com.hr
    and my new wordpress is : http://www.pvcstolarija.com.hr/novastranica
    so you will see how it must to look

Viewing 7 replies - 1 through 7 (of 7 total)
  • all posts are within the same one li element;

    what is the exact full code used for the template?

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    <div class="sliketekst">
    
    <ul>
    <li>
    <?php
        $query = new WP_Query('category_name=vijesti&posts_per_page=6');
        if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
        if (has_post_thumbnail()) {
            ?>
                <a>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
            <?php
        }
        ?>
        <h2><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <?php
        the_excerpt(); // or the_content(); for full post content
        endwhile;endif;
    ?>
    </li>
    </ul>
    <?php if ( dynamic_sidebar('sidebar desni') ) : else : endif; ?>
    
    </div>

    This is code from div which i use for that list item

    your posted code is unreadable;
    please review http://codex.wordpress.org/Forum_Welcome#Posting_Code and re-post your code accordingly.

    best use the pastebin for the full code of the template

    <div class="sliketekst">
    <ul><li>
    <?php
        $query = new WP_Query('category_name=vijesti&posts_per_page=6');
        if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
        if (has_post_thumbnail()) {
            ?>
                <a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
            <?php
        }
        ?>
        <h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <?php
        the_excerpt(); // or the_content(); for full post content
        endwhile;endif;
    ?>
    </li></ul>
    
    <?php if ( dynamic_sidebar('sidebar desni') ) : else : endif; ?>
    
    </div>

    Appeareantly i have solved my issue but i like to know how to paginate my post in this way if anyone know

    The issue was in wrongly settings of mine ul li element

    how to paginate my post in this way

    http://codex.wordpress.org/Pagination

    try to change the query line to:

    $query = new WP_Query('category_name=vijesti&posts_per_page=6&paged='.get_query_var('paged'));

    and add something like this before the endif of the loop:

    <?php
    next_posts_link( 'Older Entries', $query->max_num_pages );
    previous_posts_link( 'Newer Entries', $query->max_num_pages );
    ?>

    http://codex.wordpress.org/Function_Reference/next_posts_link#Usage_when_querying_the_loop_with_WP_Query

    <div class="sliketekst">
    <ul>
    <?php
    
        $query = new WP_Query('category_name=vijesti&posts_per_page=6&paged='.get_query_var('paged'));
        if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
        if (has_post_thumbnail()) {
    
      ?>
    
    <?php
    
        }
        ?>
    
        <li><h2><?php the_post_thumbnail(); ?><br/><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title();?></a></h2>
        <?php
    
      $excerpt = get_the_excerpt();
      echo string_limit_words($excerpt,25);
    // the_excerpt(); // or the_content(); for full post content
    
     endwhile;
    next_posts_link( 'Older Entries', $query->max_num_pages );
    previous_posts_link( 'Newer Entries', $query->max_num_pages );
    
    endif;
    ?></li></ul>
    
    </div>

    I have try in this way but it doesnt work
    Can you help with this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to make list item in 3 column and 2 row’ is closed to new replies.