Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Forum: Fixing WordPress
    In reply to: posts in a line
    Thread Starter lucrezia_borgia

    (@lucrezia_borgia)

    ok, guys. been a while and i figured it out recently. maybe just in case someone will need it, the code is:

    <ul class="block1">
    
    	<?php $posts = get_posts ("numberposts=1"); ?>
    	<?php if ($posts) : ?>
    	<?php foreach ($posts as $post) : setup_postdata ($post); ?>
    
    		<li><h2><a href="<?php the_permalink(); ?>" <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail();
    }
    ?></a></h2></li>
    
    	<?php endforeach; ?>
    	<?php endif; ?>
    
    </ul>
    
    <ul class="block2">
    
    	<?php $posts = get_posts ("numberposts=1&offset=1"); ?>
    	<?php if ($posts) : ?>
    	<?php foreach ($posts as $post) : setup_postdata ($post); ?>
    
    		<li><h2><a href="<?php the_permalink(); ?>" <?php
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail();
    }
    ?>
    </a></h2></li>
    
    	<?php endforeach; ?>
    	<?php endif; ?>
    
    </ul>

    and so on and so forth.
    where: numberposts=1 tells to display (1) post in a block

    offset=1 tells to omit previous (1) post

    <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
    }
    ?>
    allows you to use thumbnail instead of content and stuff…
    css is styled to your preferences
    🙂

    Forum: Fixing WordPress
    In reply to: posts in a line
    Thread Starter lucrezia_borgia

    (@lucrezia_borgia)

    thank you Esmi!
    However manual adjustment is somewhat difficult to maintain.
    anyway, thank you again for sharing ideas 🙂

    Forum: Fixing WordPress
    In reply to: posts in a line
    Thread Starter lucrezia_borgia

    (@lucrezia_borgia)

    basically, it would be easier to visualise if you imagine a table in which each cell is a post, right? and my homepage image will take 4 cells (two upper and two lower) somewhere in the center of this table. and i dont want it to cover my posts, that is why i thought knowing ids of posts would help me to situate them wherever i want them to be altogether with homepage image.
    though i understood what you mean and am really thankful 🙂

    Forum: Fixing WordPress
    In reply to: posts in a line
    Thread Starter lucrezia_borgia

    (@lucrezia_borgia)

    Thank you, Esmi,
    I’m sorry for probably a stupid question, but how do i designate post id withing the loop? should i use some kind of plugin or there is a function to it?
    I have thumbnails to represent posts, and right now the loop looks like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    so i guess i need id for thumbnails, right? to keep the structure

    again, i’m sorry, i’m new to all this, but i would really appreciate your help

Viewing 4 replies - 1 through 4 (of 4 total)