WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Home page question (19 posts)

  1. breger
    Member
    Posted 8 years ago #

    I have a separate Home page but when I click on "previous" link at the foot of the page it still shows the inserted text from the home page - and not the expected "normal" index page content. Is there a problem or is there something I need to change? My URL is http://www.airdrie.net/weblog2

  2. FruitFly
    Member
    Posted 8 years ago #

    That previous link is to the previous posts on your blog (thus the "Previous Entries") - not the previous page you were on. (It's not a like a "back" link.)

    If you want a link back your index, you'll need to add that in yourself.

  3. breger
    Member
    Posted 8 years ago #

    Thanks FruitFly. I understand what you mean but I thought that the previous entry link when clicked would use the standard "index.php" code and not the "home.php" code when showing the next page. Any other ideas?

  4. FruitFly
    Member
    Posted 8 years ago #

    Ahh, sorry. I've not worked with a home.php template before, and I didn't understand that was what you were referring to. I don't know if that's expected behavior or not.

    Maybe someone else who has experience with home.php can help... should the previous link use index.php or home.php?

  5. iand
    Member
    Posted 8 years ago #

    I ran into the same thing a few months ago and never found a satisfactory answer - I ended up with using index.php and some horrible conditional statements.

    As to the behaviour, it is 'correct', but as with breger I would expect them to go to index.php. I guess there is a core file hack or perhaps someone is looking for a plugin suggestion....

  6. breger
    Member
    Posted 8 years ago #

    IanD - a plugin would be great!! Anyone???

  7. breger
    Member
    Posted 8 years ago #

    Sorry for dredging this up again, but I cannot find anything to get around this problem. Anyone have any ideas?

  8. Jaycos
    Member
    Posted 8 years ago #

    I did it the same way. And that is suggested here:
    http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters

    I tried to do something with is_home(), but that didn't work, because the "next page" seems to be "home" as well.

    I read several times that people suggest to build a new category e.g. called "Blog" an put all the other categories in it. Than you can link to the Blog-cat to show all posts. But I don't like that and the German Doku doesn't, too:
    http://doku.wordpress.de/Template_Tags/query_posts#Posts_aller_Kategorien_abfragen

    But i don't understand how to use
    rewind_posts();
    query_posts('cat=0');

    to get what we want... :-(

  9. breger
    Member
    Posted 8 years ago #

    Sounds like I've hit on a problem that there's no easy answer to. If there was a way to have static text above the normal posts on the first page then when "previous" link is clicked it would allow the normal index.php to take over with page 2 etc then we would be in business. I'm open to any ideas though!

  10. moshu
    Member
    Posted 8 years ago #

    @breger,
    That easily can be done with an if_statement. See Conditional_Tags. The text you want only on the main page should be in a if is_home... etc. code.

    With the home.php - I also discovered recently that the prev-next don't work with it. I guess, it's time to post a bug report about it.

  11. breger
    Member
    Posted 8 years ago #

    Thanks Moshu. Is there any way I can use the index.php as a homepage with static text before the posts entries? I should also add that I would prefer this not to reappear on the next pages (when the "previous" link is clicked).

  12. moshu
    Member
    Posted 8 years ago #

    breger, that's exactly what I described in the post above.

  13. breger
    Member
    Posted 8 years ago #

    Sorry Moshu - not that good with understanding php. Can you explain if I need to use the "home.php" and insert the "if_home" code on it, or can I use the "index.php" and therefore get the use of the "previous" link which will not have the added text above the post entries?

  14. moshu
    Member
    Posted 8 years ago #

    Sorry, if I wasn't clear. The solution using the conditional tag if is_home is meant to be used with the index.php - so you could use the next-prev, too.
    As you can see from the Template_Hierarchy index.php can be used for almost everything...
    So by using the conditional you'd tell it: if we are on the main/home/first page of the blog ==> show this, else do your ordinary job :)

  15. Jaycos
    Member
    Posted 8 years ago #

    As i described above i tried the "is_home"-thing on my home.php but the static content nevertheless appeared on the "previous"-page. THIS seems to be a bug.

  16. Jaycos
    Member
    Posted 8 years ago #

    To make it concrete. My home.php or index.php looks like this:
    <?php get_header(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (is_home()) { ?>
    <h2>Welcome</h2>
    <?php } ?>
    ...The Loop...

    But the "Welcome"-Headline is visible not only on
    http://www.mydomain.com/blog/ but on http://www.mydomain.com/blog/page/2/ as well.

  17. iand
    Member
    Posted 8 years ago #

    I am not sure if it a bug or slightly convoluted logic (after all, you are still home, just looking at page two of it).
    For a fix try ((is_home()) && ($paged <= "1"))
    though you might need == instead of <=

  18. breger
    Member
    Posted 8 years ago #

    IanD. Thanks - I got this to work!! Your code above was almost correct (you placed an extra bracket after "home()" ). When this is removed the "previous" link works as normal.
    So the code to insert is:
    <?php if (is_home() && ($paged <= "1"))
    { ?>

  19. Seaborn
    Member
    Posted 7 years ago #

    I tried that fix for a similar problem and it broke the load of the page.

    http://www.joyhog.com/reviews/

    I put it in my index.php. Im using the home.php using a static front page and putting the blog on a non root directory using this:

    http://codex.wordpress.org/Pages#Making_your_blog_appear_in_a_non-root_folder

    Is there any other quick code fix for this?

Topic Closed

This topic has been closed to new replies.

About this Topic