• Anonymous

    I’ve been trying to limit number of posts on my homepage to 5.
    I went to Options – Reading and set number of posts on homepage to 5.
    Easy!
    It looks great in Firefox, but when bring the page up in IE every post ever added is still showing.
    Am I missing something here or could I add a line of code to index.php to make IE do as it is told?
    Thanks!
    Geo

Viewing 14 replies - 1 through 14 (of 14 total)
  • Try a hard refresh in IE by pressing CTRL-F5.
    The code works in all browsers.

    Thread Starter Anonymous

    Thanks for the pointer Podz,
    I’ll try it . . .
    No that didn’t work.
    I did notice though that in IE as well as displaying all posts on the homepage it also displays the last five headings in bullet list format at the top of the homepage.
    Geo

    Thread Starter Anonymous

    Sorry, that’s true of Firefox too – it has the last five post titles in bullet list format too.
    I’ll sort that, but still wonder why IE shows all posts when Firefox limits it to last five – as needed.
    Geo

    joe_doufu

    (@joe_doufu)

    There is no possible way that can happen. The PHP script interpreter will send the same HTTP output to any browser. Either you have an old version cached in your browser (solve this by holding CTRL while you click “Refresh”) or perhaps you’ve got your stylesheet coded in some strange way that the entries are invisible in one browser (or are the same color as the background).
    I would put my money on the browser cache being the problem.

    Thread Starter Anonymous

    Doh!
    Joe you’re money would be safe. Podz, you were right.
    I did force refresh the page, but no joy.
    Then I closed IE altogether, opened it up and bingo!
    Thanks to you both.
    One more question. If a list of the five most recent post titles is appearing in an absolute position on my page (top right) where do I need to look to remove it – is it a stylesheet problem or index.php? I have been through both, but can’t see any code saying “put last five titles at top of page” or similar.
    Any pointers?
    Geo

    joe_doufu

    (@joe_doufu)

    I never had that feature on my default WP blog. Did you add a plugin that gave you “most recent entries”?
    Somewhere in your code you have two different sections of code that output the most recent entries. In the default WP, there’s one in the index.php file. The second one may be in index.php, or perhaps my-hacks.php or some plug-in file. Just delete it from the PHP.
    Good way to find it is to search for a “foreach” statement in the PHP file(s) because we know there would have to be a “loop” in the code.

    joe_doufu

    (@joe_doufu)

    where’s your blog, by the way?

    Thread Starter Anonymous

    Thanks Joe,
    I’m not using the default template – I am trying to use the WYSIWYG table driven template (I know, I know – don’t use tables! – it’s just I wanted three columns and tables seem to be easier to work with until I learn more CSS).
    Everything is going to plan bar that pesky list of five post titles.
    My blog is at:
    https://www.entrepreneur.co.uk/wordpress/index.php
    You’ll see what I mean by the list of five posts at the top right corner. That’s what I’m trying to get rid of.
    Geo

    joe_doufu

    (@joe_doufu)

    Looking at the code of the page (which is the PHP’s output) I can see these five entries appear after the </head> tag and before the <body> tag. Look at your index.php and see if there’s any PHP code between those tags. It would probably be safe to delete anything that appears between those two tags. Back up the file, of course.

    Thread Starter Anonymous

    <div id=”head”> was found, deleted and hey presto – they’ve gone!
    Many thanks for your help Joe – you’ve made my day!
    Merci beaucoup / ??muchas gracias! / thanks a lot,
    Geo

    TechGnome

    (@techgnome)

    Anon – you may want to check out the Trident template at https://www.atthe404.com/blog/index.php?p=186
    It’s what I use on my site – a 3 col-layout. And it works great.
    TG

    Thread Starter Anonymous

    TG,
    Thanks for the tip. I’m checking it out.
    Geo

    Thread Starter Anonymous

    FYI,
    For anyone looking on how to limit # of posts on the homepage, but possible maintain an alternative page that still shows general posts, do something like:

    if ($_SERVER[REQUEST_URI] == "/") {
    $posts = get_posts('numberposts=1');
    } else {
    }

    Right above:
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    in index.php

    I’m new to this, but I’m trying to use get_posts to limit the number of posts displayed on the front page, and it returns a blank screen.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘limiting posts on homepage’ is closed to new replies.