• Resolved breger

    (@breger)


    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 https://www.airdrie.net/weblog2

Viewing 15 replies - 1 through 15 (of 18 total)
  • fruitfly

    (@fruitfly)

    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.

    Thread Starter breger

    (@breger)

    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?

    fruitfly

    (@fruitfly)

    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?

    iand

    (@iand)

    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….

    Thread Starter breger

    (@breger)

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

    Thread Starter breger

    (@breger)

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

    jaycos

    (@jaycos)

    I did it the same way. And that is suggested here:
    https://codex.www.ads-software.com/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:
    https://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… ??

    Thread Starter breger

    (@breger)

    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!

    moshu

    (@moshu)

    @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.

    Thread Starter breger

    (@breger)

    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).

    moshu

    (@moshu)

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

    Thread Starter breger

    (@breger)

    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?

    moshu

    (@moshu)

    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 ??

    jaycos

    (@jaycos)

    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.

    jaycos

    (@jaycos)

    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
    https://www.mydomain.com/blog/ but on https://www.mydomain.com/blog/page/2/ as well.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Home page question’ is closed to new replies.