Display most recent post in Wordpress
Posted: 08 December 2009 12:23 AM   [ Ignore ]
Newbie
Rank
Total Posts:  10
Joined  2009-11-22

After a couple of months of not touching my new portfolio website design I’ve finally got around to continuing it.

I keep struggling getting Wordpress to do the simplest of tasks though! Here I’m simply trying to get it to display my most recent post on the homepage… it was working originally but I must have altered something without realising and now it’s just displaying all of them!

Here is the code I have in my index.php (it’s using example code from the Codex)

PHP Code:
      <?php $my_query = new WP_Query(‘posts_per_page=1’);
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
                <div id=“h1-wrapper”><h1><?php the_title(); ?></h1></div>
                  <div class=“detail”>
                    <span class=“info”>Filed under <?php the_category(’, ‘, ‘multiple’); ?> | <?php the_date(); ?></span>
                    <span class=“listening-to”>Listening to: <span class=“highlight”>Orbital</span></span>
                  </div>
                  <div class=“content”>
                      <?php the_content(); ?>
                  </div>
      <?php endwhile; ?>
       
      <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
                <div id=“h1-wrapper”><h1><?php the_title(); ?></h1></div>
                  <div class=“detail”>
                    <span class=“info”>Filed under <?php the_category(’, ‘, ‘multiple’); ?> | <?php the_date(); ?></span>
                    <span class=“listening-to”>Listening to: <span class=“highlight”>Orbital</span></span>
                  </div>
                  <div class=“content”>
                      <?php the_content(); ?>
                  </div>
      <?php endwhile; endif; ?>
Can anybody see the problem?

Oh and I thought I would post the problem here, as I find the official Wordpress forum is useless! Anybody else find that?

Profile
 
 
Posted: 08 December 2009 02:02 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  10
Joined  2009-11-22

whats this han!!!

Profile
 
 
Posted: 13 July 2010 11:05 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  1
Joined  2010-07-13

Did you ever get a reply to shed some light on this Wordpress problem? I am having something similar!

Something you might want to look into is that too many loops on a page can stop them all running. Have you tried reducing your code to its basics to find out what is causing the error?

Profile
 
 
Posted: 14 July 2010 10:57 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  2
Joined  2010-07-14

I have wordpress 3.0 installed on my machine, i am trying to add this code in template single post file but it is not working there, here is my Tech Blog i think it is not compatible with new wordpress software, did you try it on new wordpress?

Profile
 
 
Posted: 11 October 2010 01:51 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  39
Joined  2010-10-06

Try that:

<?php $recentpost = new WP_Query(“showposts=1”); while($recentpost->have_posts()) : $recentpost->the_post(); ?>
// do stuff in here like display the content, burun estetiği and title etc.
<?php endwhile; ?>

Profile
 
 
Posted: 12 October 2010 11:05 PM   [ Ignore ]   [ # 5 ]
Newbie
Avatar
Rank
Total Posts:  11
Joined  2010-10-12

i believe the new wordpress has options already embedded for this, so no need to jumble it up…..


____________________________________
my free photoshop tutorials

Profile
 
 
Posted: 13 October 2010 03:01 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  1
Joined  2010-10-13

You do have to watch it, it’s all about processing the loop in the right order, but some themes can mess with that.

Profile
 
 
Posted: 13 October 2010 10:01 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  44
Joined  2010-10-13

dont waste your time, use new version of WP and enjoy… that’s all..

Profile
 
 
Posted: 21 December 2010 05:25 PM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  3
Joined  2010-12-21

You can try out thesis frame work,it’s really robust and has a great forum that u can learn from.

Profile
 
 
Posted: 18 January 2011 01:22 AM   [ Ignore ]   [ # 9 ]
Sr. Member
RankRankRankRank
Total Posts:  139
Joined  2010-04-23

Upgrade you wordpress and try again.

_____________________________________
Sudoku - Play Flash Games - Play Flash Games

Profile
 
 
Posted: 22 January 2011 07:46 AM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  2
Joined  2011-01-22

Try to upgrade your wordpress with newer, and try again.! This problem is Trending Topics on world of blogging. Truly is very easy but you don’t try to search it hardly.
_________________________________________________
Tempat wisata di Bandung | Gunung Bromo | Raja Ampat

Profile
 
 
Posted: 29 January 2011 10:36 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  15
Joined  2011-01-17

If you exported a template using Artisteer Version 3, you’ll be very pleased with the Theme’s Options panel under the Appearance Tab of your Dashboard

Profile
 
 
Posted: 08 February 2011 06:51 PM   [ Ignore ]   [ # 12 ]
Newbie
Avatar
Rank
Total Posts:  11
Joined  2011-02-08

Upgrade to the latest version and try again - you will also benefit from all the improvements that were made in version 3

Dovetail Jigs

Profile
 
 
Posted: 18 February 2011 11:33 AM   [ Ignore ]   [ # 13 ]
Newbie
Avatar
Rank
Total Posts:  14
Joined  2011-02-18

Thank for this thread. I will try wordpress 3.0.

Broan Range Hoods | Leather iPad Cases

Profile
 
 
Posted: 20 February 2011 01:55 PM   [ Ignore ]   [ # 14 ]
Newbie
Avatar
Rank
Total Posts:  2
Joined  2011-02-05
trader - 29 January 2011 10:36 PM

If you exported a template using Artisteer Version 3, you’ll be very pleased with the Theme’s Options panel under the Appearance Tab of your Dashboard. You’ll definitely want to make use of this very practical feature as it will save you a lot of time and searching trying to change or edit simple items.

Post excerpts can already be added at the bottom of individual posts if you would like to use a separate small post introductory text rather than just using the more tag for only displaying the first portion of the post when viewing a category. It’s an excellent option to display the best part of your content in a small amount of space as a teaser to get people to read the full post. In the Theme Options page, you can choose to automatically generate an excerpt from all posts that you have not chosen to use the more-tag for or that you have not manually added an excerpt to. You can also choose the word number you’d like to cap the excerpts to in these options, as well as the tags you’d like to be able to include (such as bolding font, italics, and font heading styles.) You can also choose to apply your excerpt tag filters if desired.

I have Artisteer 2 and have been reluctant to upgrade to V3. So you think that upgrading to V3 Artisteer will work fine with WP 3? Anyone else had any issues with v3 Artisteer and WP 3?

Profile
 
 
Posted: 28 March 2011 09:53 PM   [ Ignore ]   [ # 15 ]
Newbie
Rank
Total Posts:  23
Joined  2011-01-06

Some people like to display recent posts with a title and a short description. There are multiple ways of accomplishing that.

Profile