• 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!

Viewing 15 replies - 1 through 15 (of 21 total)
  • Have you look thru the following list of archive-related plugins?
    https://codex.www.ads-software.com/Plugins/Archive

    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?

    Thread Starter aleister

    (@aleister)

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

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

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

    Then take a look at this:

    https://codex.www.ads-software.com/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:)

    Thread Starter aleister

    (@aleister)

    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.

    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?

    Thread Starter aleister

    (@aleister)

    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: https://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?

    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?

    Thread Starter aleister

    (@aleister)

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

    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:

    https://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 ??

    Thread Starter aleister

    (@aleister)

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

    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”

    Thread Starter aleister

    (@aleister)

    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: https://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)

    I really like the “Simple Sitemap” idea…any chance of someone posting the trimmed/corrected code?

    Moderator James Huff

    (@macmanx)

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Sitemap Page?’ is closed to new replies.