WordPress.org

Ready to get started?Download WordPress

Forums

Sitemap Page? (22 posts)

  1. Aleister
    Member
    Posted 9 years ago #

    I am trying to figure out a way to generate a sitemap for WordPress. I am using 1.5.1.2. The ideal situation would be to have a page which looks like this:

    Category 1
    - Some post
    - Some post
    Category 2
    - Some post
    - Some post
    etc..

    I do not want the posts themselves to show. Only the titles (with links pointing to the actual posts). It would be important for it to show all of them. Any one have any suggestions? I have not seen this done before.

    I did read about the new Google sitemap feature, and I plan to implement an XML sitemap such as that, but I also wanted a traditional one. Thanks for any suggestions!

  2. Joshua Sigar
    Member
    Posted 9 years ago #

    Have you look thru the following list of archive-related plugins?
    http://codex.wordpress.org/Plugins/Archive

  3. Jinsan
    Member
    Posted 9 years ago #

    You could create your own archive page as you want above:

    category link
    call to all entries under that category

    next category
    call to all entries under that category

    and so on.

    That might be on solution?

  4. Aleister
    Member
    Posted 9 years ago #

    alphaoide: There are no plug-ins there to do what I want. Everything is Month-based instead of category based.

    Jinsan: That sounds nice but I have no idea how to do it :)

  5. Jinsan
    Member
    Posted 9 years ago #

    Hi Aleister, take a look at the following I briefly cover creating a basic archive.php file

    http://wrc.os42.com/?p=195

    Then take a look at this:

    http://codex.wordpress.org/Template_Tags/get_posts

    So what you can try is this in your archive.php:

    <h2>Catgory Link or Plain Text</h2>
    <ul>
    <?php
    $posts = get_posts('numberposts=-1&offset=0&category=1');
    foreach ($posts as $post) :
    ?>
    <li><a href=\"<?php the_permalink(); ?>\"><?php the_title() ?></a></li>
    <?php
    endforeach;
    ?>
    </ul>

    Or something along those lines, hopefully someone can make it seem more logical and clear, it's still morning for me:)

  6. Aleister
    Member
    Posted 9 years ago #

    get_posts works great for the loop. I have that part down.

    What I can't find is a function to stick all the categories in an array, letting me go through them each. Pulling out the entries in each one.

  7. Jinsan
    Member
    Posted 9 years ago #

    What I can't find is a function to stick all the categories in an array, letting me go through them each. Pulling out the entries in each one.

    You speak in tongues :)

    Can you find an example of this that can provide a visual idea of what you're trying to achieve? are you talking like a tree structure? User clicks the cat, the posts drop down?

  8. Aleister
    Member
    Posted 9 years ago #

    Sorry for the confusion :) I would have posted an example, but I have not seen a single site do what I want :)

    This is a static page I just put up: http://www.dagondesign.com/sitemap/

    This is my goal. A page that will show all posts sorted by category. :)

    With the category names linking to the cat pages, and the post names linking to the posts of course.

    With the code you gave me, I can automatically generate a list of the posts for one specific category. My main problem now is just having it automatically go through all the categories, to generate this list. Know what I mean?

  9. Jinsan
    Member
    Posted 9 years ago #

    OK I see what you mean. I'm not a professional and half the time I don't know my name but have you tried:

    <h2>Catgory Link or Plain Text</h2>
    <ul>
    <?php
    $posts = get_posts('numberposts=-1&offset=0&category=1');
    foreach ($posts as $post) :
    ?>
    <li><a href=\"<?php the_permalink(); ?>\"><?php the_title() ?></a></li>
    <?php
    endforeach;
    ?>
    </ul>

    repeated that with a br tag at the end, and changed the cat number or are you saying it won't let you repeat that code?

  10. Aleister
    Member
    Posted 9 years ago #

    I know what you mean, and I may have to fall back on that method if nothing else, but I was trying to _not_ have to manually duplicate that code for each category. I was trying to find a way for it to automatically go through all the categories and run the code itself :)

  11. Jinsan
    Member
    Posted 9 years ago #

    Hmm fair enough, I mean I just did it and the only thing I had to modify was the category number - there might be an automated way to do this but I gave it ago anyway, something like this perhaps? The posts are all for that particluar category:

    http://sekhu.net/wp/sitemap/

    Remember you only have to put the code it once - after that the page updates on its own without you having to do so, so it's not too much effort ;)

  12. Aleister
    Member
    Posted 9 years ago #

    Unless I create a new category, and forget to update the sitemap code ;)

    I know, it is not a huge deal. I will figure something out :)

  13. Jinsan
    Member
    Posted 9 years ago #

    you could always request a plugin such as this - it might be easy for an author to swap something like....

    Ok i have a suggestion but would require begging and pleading on your part.

    You COULD ask the author of Simple Archives or make a request for it swap outthe value for the date/month/year and to replace this with the category instead.

    I think simple archives would be the perfect solution for you, if you could do that as it outputs the list nicely.

    Make a request contact a few people do a run around, maybe someone will turn around and say "yeah, nice idea"

  14. Aleister
    Member
    Posted 9 years ago #

    I just got it working :) I ended up using 'Nicer Archives', cutting out about 90% of the code that I did not want (for the drop-down boxes, etc..), since I wanted something simple. The end result is a fully automatic sitemap. I even found a website which explains how to fix a permalink bug in the original code.

    Check it out if you like: http://www.dagondesign.com/sitemap/

    (There are still not that many articles on the site since I am moving them over but you get the idea - I did test with some extra dummy cats too and it looked good)

  15. totenmaske
    Member
    Posted 9 years ago #

    I really like the "Simple Sitemap" idea...any chance of someone posting the trimmed/corrected code?

  16. totenmaske
    Member
    Posted 9 years ago #

    "http://www.arnebrachhold.de/2005/06/05/google-sitemaps-generator-v2-final"

    Thank you, that's great but that link is for the Google Sitemap, and I was referring to Aleister's modified "Nicer Arichives" code which creates a more traditional sitemap. I've already begun implementation of the Google Sitemap but have been looking for a more traditional sitemap as well which is what led me to this thread.

  17. ragecg
    Member
    Posted 8 years ago #

    Searching for "Sitemap" in this forum only gets this thread, or info on the Google Map feature.

    Like Totenmaske asked, might there be a way you could post your final working code Aleister?

    This is a great feature missing from the "automatic" nature of WP.

    Thanks for any help!

  18. tauquil
    Member
    Posted 8 years ago #

    There is of course also Live Archives.

    Similar to what you've got implemented now but the titles only appear when you click on a category. Useful if you have a lot of posts and you don't want to cram them all into one page. And frankly it's pretty cool!

    You can see my implementation over here. Under Live Archives, click on category to see how the posts are organised.

  19. webstimulation
    Member
    Posted 8 years ago #

    Aleister, would you mind sharing your code with us?

    I really would like to do this for my site, but am new to wordpress and PHP.

  20. Aleister
    Member
    Posted 8 years ago #

    I have been getting so many requests for this, that I am going to put an article up on my site that explains how I did it. I should have it up by tonight - http://www.dagondesign.com

  21. Aleister
    Member
    Posted 8 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags