• im new in wordpress, i try to do a row table of a specific category. this should get out in a div, with the post image as background. the title and the text should overlay the image. could you help me?

    [php]`<?php
    // code to display a number of posts in multi columns top-to-bottom left-to-right
    ?>
    <?php global $query_string; ?>

    <?php
    $set_number_of_columns = 100; // enter numbers of columns here;
    $set_number_of_rows = 100; // enter numbers of rows here
    $set_showpost = $set_number_of_columns * $set_number_of_rows ;

    //setup query with parameter for paged
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    //query_posts($query_string.’&showposts=’.$set_showpost.’&paged=’.$paged);
    // get number of posts for this,
    $num_of_posts = $wp_query->post_count;
    // make adjustment for paged to get three equaly long columns even on last paged page
    // divide by $set_number_of_columns to get number per column,
    // round up to next integer to make $ppc posts per column variable, or $set_number_of_rows whatever is smaller
    $ppc = min(ceil($num_of_posts/$set_number_of_columns),$set_number_of_rows);
    // calculates number of rows, i.e. showposts for the following query_posts and get_posts
    ?>
    <?php for ( $col = 1; $col <= $set_number_of_columns; $col += 1) { ?>
    <div class=””>
    <?php
    $row = 1;
    $noffset = ($col -1) * $ppc + ($paged – 1) * $set_showpost ; //calculate offset parameter if paged
    $posts = get_posts(‘numberposts=’.$ppc.’&offset=’.$noffset.’&cat=103′);
    foreach ($posts as $post) : start_wp(); ?>
    <div id=”subImageContainer4″ class=”subImageContainer”>
    <!– start of anything to do with post –>
    <h1><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h1>
    <div class=”storycontent2″ >
    <?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?>
    <?php the_excerpt(__(‘(more…)’)); ?>
    </div>
    <!– end of anything to do with post –>
    </div> <!– end #post –>
    <?php
    $row++;
    endforeach; ?>
    </div>`[php]

  • The topic ‘how to show a grid of wordpress posts post img as background, title and text ove’ is closed to new replies.