Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7090131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:00:30+00:00 2026-05-28T08:00:30+00:00

I’ve start meaking my own wordpress template, in first step I made sketch in

  • 0

I’ve start meaking my own wordpress template, in first step I made sketch in HTML. It’s look like this.

Sketch

I was thinking about that, black rectangle is “Post Image”, and I want 4 in one line. That I should solve with for loop, in while loop(I guess).
In my opinion it should look like this (It’s loop from twenty eleven theme)

<?php
get_header(); ?>

        <div id="primary">
            <div id="content" role="main">

                <?php while ( have_posts() ) : the_post(); ?>
                    <?php for(i=0;i<8;i++)?>
                    {<?php get_template_part( 'content', 'page' ); ?>}
                    <?php comments_template( '', true ); ?>

                <?php endwhile; // end of the loop. ?>

            </div>
        </div>
<?php get_footer(); ?>

But I have problem, how I should solve problem with positioning. I guess it should be one class post. Below I give you my codes. Please help.

My html code:

<div class="postbar">
    <div class="post1">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post2">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post3">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post4">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
</div>
<div class="postbar">
    <div class="post1">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post2">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post3">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
    <div class="post4">
        <a href="index.html">
        <div id="postOver"></div>
        </a>
        <div id="postText">text</div>
    </div>
</div>

My CSS code:

  div.postbar{
        position:relative; left:255px; 
        height:222px;
        }
    div.post1 {
        margin-top:17px;
        position:relative; 
        margin-left:1%;
        padding-left:3px;
        padding-right:3px;
        width:222px;
        height:222px;
        }
    div.post2 {
        position:absolute;  top:-1px; left:260px;
        margin-left:1%;
        width:222px;
        height:222px;
        }
    div.post3 {
        position:relative;  top:-222px; left:520px;
        margin-left:1%;
        padding-left:3px;
        padding-right:3px;
        width:222px;
        height:222px;
        }
    div.post4 {
        position:relative;  top:-444px; left:780px; 
        margin-left:1%;
        padding-left:3px;
        padding-right:3px;
        width:222px;
        height:222px;
        }
    div.postNext {

        position:absolute; left:250px; top:-1px; 
        margin-left:1%;
        padding-left:3px;
        padding-right:3px;
        width:222px;
        height:222px;

        }

    #postOver{
        width:222px;
        height:222px;
        background-image:url(img/arch.jpg);
        box-shadow:0px 0px 3px #000000;
        -webkit-transition:width 1s;
        }
    *:hover > #postOver{
        width: 0;
    }
    #postText{
        position:relative; top:-222px;
        font-size:12px;
        width:222px;
        height:222px;
        box-shadow:0px 0px 3px #000000;
        color:black;
        text-align:center;
        z-index:-1;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:00:31+00:00Added an answer on May 28, 2026 at 8:00 am

    Like Mr.TAMER said, would be better to search for an Answer in WordPress Exchange.

    Here is code that could be a possible solution for your problem:

    <style type="text/css">
        .post { float:left; display:block; width:222px; height:222px; margin: 0 3px; }
        .post.first { margin-left:0px; }
        .post.last { margin-right:0px; }
    
        /* Clear fix from http://css-tricks.com/snippets/css/clear-fix/ */
        .clearfix:after { visibility: hidden;display: block;font-size: 0;content: " ";clear: both;height: 0; }
        * html .clearfix { zoom: 1; } /* IE6 */
        *:first-child+html .clearfix { zoom: 1; } /* IE7 */ 
    </style>
    
    <?php
        $args = array( //Query variables take a look at http://codex.wordpress.org/Class_Reference/WP_Query
    
        );
        $query = new WP_Query( $args ); // Doing the Query
    
        if( $query->have_posts() ) { // Checking if there is any posts with the arguments above
    
            while( $query->have_posts() ) { // Looping throught the selected posts
                $query->the_post(); // Selecting the next as the actual Post
                ?>
                <div class="post<?php echo ( $current_post == 0 ? " first" : ( $current_post == $post_count ? " last" : "" ) ); ?>">
                    <a href="index.html">
                        <div id="postOver"></div>
                    </a>
                    <div id="postText">text</div>
                </div>
                <?php
                if( $current_post == $post_count )
                    echo "<div class=\"clearfix\"></div>";
            }
        } else { // If there isn't any posts with the Arguments set above
    
    
        }
        wp_reset_postdata(); // Reseting the Post data so you can re-use the loop 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to count the length of a string with PHP. The string
Specifically, suppose I start with the string string =hello \'i am \' me And
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.