• Hello everyone,

    Anybody got any idea how I can display one post on the front page only, without changing the Reading Options?
    In the reading options one can set the maximum number of posts in one page to “1”.
    But this doesn’t work for my case, since I want several posts to appear on any normal page except the front page.

    Tricky problem, I know…
    Anyone who can help me? Thanks for your help!

    Jay

Viewing 15 replies - 16 through 30 (of 32 total)
  • I’ve done everything your post says to do, but no joy yet.
    That’s because the Benevolance theme uses the old WP1.2 method of retrieving posts i.e. instead of
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    it uses
    foreach($posts as $post) { start_wp();

    Hence, the_loop will need to be modified to the new WP1.5 way of doing things before you can use this technique.

    Thread Starter jaywalker

    (@jaywalker)

    ifelse, after including the query_posts there is no more post on the front page at all. What to do?

    Do you have a link?

    Thread Starter jaywalker

    (@jaywalker)

    https://www.leidartikel.de/wordpress/

    When you click on the column title “Leidartikel” the page that appears contains 1 article, the way it should be. But the front page doesn’t…

    That is the default behavior. Single post for singles. All the latest posts on the front. It will stay that way until you change it.

    Can you check that the post has some content? That particular post (the latest one) when viewed individually appears to be devoid of content.

    Another randomly chosen post appears fine.

    Thread Starter jaywalker

    (@jaywalker)

    You are 100% right. That was exactly the problem. It works now. Thanks so much, ifelse, for your great help today!

    No problem. Glad I could help:-)

    Thanks for all the help. Here’s my code on home.php . Now I get the following error on https://japanesetrash.com:

    Parse error: parse error in /home/httpd/dbannon/japanesetrash.com/html/wp-content/themes/benevolence/home.php on line 29

    The if/endifs and while loops haven’t been been properly closed. You’re probably after something like this (There’s been a quick attempt to fix your code made but no promises).

    BTW, in future, for large code chunks, could you stick it in a text file and include a link or use this site. If you could edit your post to do this, it’ll be much appreciated by everyone here:-)

    First of all, thanks for the advice about posting code, it’s much appreciated.

    Secondly, you’re a real champ for helping me out with this. I’ve got a lot to learn and your patience and instruction has been awesome. The home.php page now works!

    I have recently implemented “Page To Front” plugin also and wondered if there is any way to get rid of the date for the post. I want it to almost act like a static page and it seems odd to leave a date for the post in there.

    Thread Starter jaywalker

    (@jaywalker)

    An update and new problem to this case: It works fine now to only display the one latest post on the front page with

    <?php query_posts(‘posts_per_page=1’); //returns only the front page ?>

    added in the home.php page right before the loop. However, I would like to display the latest post of ONE category only. Suppose I’ve got 5 categories and only want the latest post of category 1 to appear on the front page. How do I do that?
    Changing the code to

    <?php query_posts(‘category=1&posts_per_page=1’); //returns only the front page ?>

    did not help. Neither did ‘category=categoryname’. Does anybody know the solution?

    Jay

    Have you tried this?

    <?php query_posts('cat=1&posts_per_page=1'); ?>

    Thread Starter jaywalker

    (@jaywalker)

    Hallo Unveiled! I’m sorry for my delayed answer. I didn’t think anyone would still answer to my post.
    However: Yes, your post helps!! I have just changed the code to your suggestion and now it works!!!
    So it was ‘cat’ instead of ‘category’. Oh my…

    Thanks a lot, Unveiled!
    Jay

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘1 post on front page only’ is closed to new replies.