henballs
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Next_and_Previous_Links lead to blank page.That kind of works, but it’s giving me an infinite loop I think.
My posts keep getting loaded and reloading and scrolls infinitely now.
Forum: Fixing WordPress
In reply to: Next_and_Previous_Links lead to blank page.Just the first page. I’m trying to make my index page have this structure:
First loop: Newest post #5 Newest post #4 Newest post #3 Second loop: Older post #2 Older post #1 (See older posts link) Etc.. keeps going till the oldest post.
Forum: Fixing WordPress
In reply to: Next_and_Previous_Links lead to blank page.Hi Kessie, I’ve two loops. I’m using offset so that the first loop is always going to be my 3 newest post. and the second loop is always going to be the “Rest” of my posts.
I’m doing this because I want to edit the first loop’s CSS to “feature” my newest posts.
If offsetting isn’t the best way to do this (cause it breaks paginaton, how should I approach this problem? How could I find the solution?
Forum: Fixing WordPress
In reply to: Why does my loop only render one blog post?Yup that was it!
Forum: Fixing WordPress
In reply to: Why does my loop only render one blog post?Ah I think I’m missing a while loop. Be right back.
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 postsThanks alchymyth! It finally works. I’ll need to go back and read some Docs on the loop, and what does and doesn’t belong in there. Cheers.
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 posts**
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 postsYeah, you interpreted it correct. I would like my blog’s first 3 posts to be thumbnails that point to the actual post. And the following posts to be regular snippets of text that point to their full sized posts.
I have
<?php add_theme_support( 'post-thumbnails' ); ?>
set in my functions.php file.I get the same results (shows title, image, full body of text) if I used the code you posted:
<div class="container"> <div class="main-content"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?>> <h2> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> </h2> <?php the_content(''); ?> <?php the_post_thumbnail(); ?> </div> <?php endwhile; ?> <?php endif; ?> </div> <div class="sidebar"> </div> </div>
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 postsIs my snippet of PHP code in the wrong place? What am I missing as a first time WP / PHP Developer?
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 postsHi alchymyth. Thanks for the help, I’m completely new first time to php and wordpress.
I currently have the following in my index.php. I’m unable to load just the 3 latest thumbnails. What the following code loads is my entire 3 blog posts.. I started to build a theme from scratch with the base files.
Is my php code suppose to be written elsewhere?
<div class="container"> <div class="main-content"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div <?php post_class() ?>> <h2> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> </h2> <?php $the_query = new WP_Query( array('posts_per_page' => 3, 'meta_key' => '_thumbnail_id' ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div id="box<?php echo $the_query->current_post+1; ?>"> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(); ?> <?php the_title(); ?> </a> </div> <?php endwhile; wp_reset_postdata(); ?> <?php the_content(''); ?> </div> <?php endwhile; ?> <?php endif; ?> </div> <div class="sidebar"> </div> </div>
Forum: Fixing WordPress
In reply to: How to get thumbnails from the latest 3 postsI’ve tried this, it looks reasonable. Not the images aren’t appearing.
<?php $the_query = new WP_Query( 'posts_per_page=3'); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div id="box<?php echo $the_query->current_post+1; ?>"> <?php if ( has_post_thumbnail($post->ID) ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail($post->ID); } ?> <?php the_title(); ?> </div> <?php endwhile; ?>