[resolved] Looking for self-updating alphabetical list of posts (32 posts)

  1. riverwriter
    Posted 10 years ago #

    On a separate page on my site, I want to list links to my posts alphabetically indicating post date and tags — and to really be outrageous, the first few lines of the post.

    I can do this by hand in a CSS/HTML table every time I post, but would like to use RSS feed if possible, and have it sort itself alphabetically, updating at time of post.

    Has any work been done on any part of this? Is there already a plugin that does it? Am I dreaming in technicolour?

  2. slnewkirk
    Posted 10 years ago #

    I second this, I to am looking to create and index page for my site.

    Scott Newkirk

  3. Chris_K
    Posted 10 years ago #

  4. 8wheels
    Posted 10 years ago #

    Dagon Design's plugin referenced by HandySolo works splendidly for this. It's just what you describe except for the outrageous part. ;)

  5. Dgold
    Posted 10 years ago #

    Anyone know if Dagon's sitemap plugin will let you simply list all posts by post-title (without sorting by category)?

    I haven't tried it yet. The sample sitemap is divided by category, which I don't want in this case.

  6. Kafkaesqui

    Posted 10 years ago #

    Listing all posts sorted by title is pretty simple. Just initialize (place before) The Loop in your Page template with the following:

    <?php query_posts('showposts=-1&orderby=title&order=ASC'); ?>

    More on query_posts():

  7. riverwriter
    Posted 10 years ago #

    Back to my original query: I have installed the sitemap generator into a Page on my WordPress 2.0.2 site, and it works like a charm. Now all I have to do is tweak it a bit. I certainly consider this worth donating to. That was a lot easier than I had thought.

  8. Aleister
    Posted 10 years ago #


    I am glad that you have found it useful :)


  9. Aleister
    Posted 10 years ago #

    Whoops.. I must have missed something in the posting rules :)

  10. moshu
    Posted 10 years ago #

    Yep. Offering paid services is a no-no (or, soliciting for "voluntary" donations...)

  11. Aleister
    Posted 10 years ago #

    I can see how it would have come off as sounding like that :) No problem.

    riverwriter: It would be fairly easy to change the script to show the first few lines. It already has the capability of showing the first X characters/words when there is no title for the post, so it would just take a little modification.

  12. riverwriter
    Posted 10 years ago #

    . . . and that modification would be . . . ?

    BTW, since these posts are mostly poetry, I would like to place a slash (/) at every hard return, since I expect that the program will run lines on . . .

  13. Aleister
    Posted 10 years ago #

    Here you go. To change the number of lines displayed you can edit the variable in the ddsg_get_contents function.


    It will display the first X lines of the posts after the post title.

    It is fairly rough.. but let me know how it works for you, and I might end up making it an option for it in the next version.

  14. riverwriter
    Posted 10 years ago #

    Thank you, Aleister. I have the new version of the plugin up and running. I must be missing something: the ddsg_get_contents function shows the number of lines set as 3, but I am getting the whole post showing. For some reason it is not truncating at the end of the third line.

    Here is the page in question: http://riverwriter.ca/wordcurrents/?page_id=83

  15. Aleister
    Posted 10 years ago #

    Your example page is not showing any lines of the content.. or did you put it back to the old script for now?

    I made a modification and uploaded it again (same link I gave you before). See how that works for you :)

  16. riverwriter
    Posted 10 years ago #

    Yes, I left the first revision up for a while, then figured I should go back to the original version for my visitors.

    I have the new version up now. It is certainly an improvement, but it cuts off, not after so many lines, but after so many line breaks. This means that poetry entries break off after two or three lines, but the prose breaks after a line break, which in this case is two paragraph breaks; sometimes that means there is a lot of text showing. Perhaps a word count would work better. I imagine a word count of twenty would be a good default.

    I am puzzled by the fact that in the second post, it seems to have picked up a bold code and made all the subsequent entries bold. Hmmm

    Since the line breaks are observed, the \ character is unnecessary. I presume I can remove it by removing the one line of code getting it. I have not edited any of the files, wanting to show you what they do as you wrote them.

    I am sorry if this is turning into an endless marathon.

  17. Aleister
    Posted 10 years ago #

    Given the varied situation (since not all of your posts are poetry, etc..) a word count might indeed be the best method.

    As far as the bold text.. that can be fixed by having the function strip out the tags.

    Try this (hopefully this will show up properly):

    function ddsg_get_contents($i) {

    global $ddsg_data;
    global $wpdb;
    global $table_prefix;

    $t_word_count = 30; // number of words to show

    $the_text = $wpdb->get_var("SELECT post_content FROM " . $table_prefix . "posts WHERE ID=" . $i);
    $the_text = strip_tags(trim($the_text));
    $t_array = explode(" ", $the_text, $word_count + 1);
    $t_output = NULL;
    for ($n = 0; $n < $word_count; $n++) {
    if ($t_array[$n]) {
    $t_output .= $t_array[$n] . " ";
    return "<br />" . $t_output . "<br />";

  18. Aleister
    Posted 10 years ago #

    In the above code, I have the variable called $t_word_count, but below, I am referencing $word_count.. just change it to $t_word_count too ;)

  19. riverwriter
    Posted 10 years ago #

    How sweet it is! It woiks!

    If you are going to incorporate this enhancement in future versions, I imagine you will want to give users the opportunity to reveal no text or as much as they want.

    One feature that we had earlier but do not now is the poetry line divisions. It is standard practice when quoting poetry that does not appear with the original line breaks, to indicate line breaks with the forward slash. I am quite happy to do without, as the plugin really achieves what I was hoping for: a manageable indication of the content.

    Thank you, Aleister! I shall put a link to your site in my note about the index.

  20. Aleister
    Posted 10 years ago #

    Glad it works :)

    One other thing you could do is wrap the displayed text in quotes, and have a "..." at the end.. or something to that effect, so that it is clearly an excerpt. Or you could use some CSS to make it stand out a bit.. anyway, up to you :)

    If you want to add the forward slashes, just append it to the string in the loop. It will, of course, apply it to non-poetry too as well, unless you gave your poetry posts an additional variable to specify them as such, and then the script could look for that variable to determine whether or not to display the slashes, but that would be getting more complex than you might want :)

    I may add it to future versions.. It is hard to decide what to add sometimes, because I do get a lot of requests. I add pretty much all of them, but there is a certain point where I have to stop so the options page does not get overloaded, and is not too complicated for people to actually use *grin*

    If I do make an option out of it, I would also throw in an option for an excerpt prefix and suffix, so one could add quotes, or some css, etc.. around the text.

    Who knows.. I may :)

  21. riverwriter
    Posted 10 years ago #

    I really like those tweaks you are suggesting.

    I awoke this morning with the thought that you could specify use of the category "poetry" — or more precisely, "verse" — as a condition for adding ' / ' at the end of each line.

    Anyway, it is a neat plugin that has dipped my feet into php.


  22. Aleister
    Posted 10 years ago #

    Good idea.. checking the category would be much easier, as it would not require any extra calls to the database.

    I will see what I can do :)

  23. Aleister
    Posted 10 years ago #

    Ok, I just uploaded a new version for you. Be sure to use the whole file, since I updated more than the ddsg_get_contents function (the way it pulls the data is a bit different).

    Here are the options you need to set:

    $t_word_count = 10;

    This is the number of words that will be shown for non-poem posts.

    $t_line_count = 3;

    This is the number of lines show for poems

    $t_eol_poems = "n";

    This is what the script looks for, to determine the end of a line in a poem. This setting may depend on how you are doing the breaks.

    $t_prefix = '<br /><span style="font-size:120%;color:#888888;">&ldquo; </span>';

    This is the prefix for each excerpt. This example adds a break, then a fancy left double quote (styled a bit).

    $t_suffix = '...<span style="font-size:120%;color:#888888;"> &rdquo;</span><br />';

    This is the suffic for each exterpt. It shows the '...' and the closing fancy double quotes.

    $t_break_cats = Array('Poems');

    This is an array of the categories that will be treated like poetry (X lines shown with the slash at the end).

    Hope it works for you :)

  24. Aleister
    Posted 10 years ago #

    I was worried that would happen :)

    $t_eol_poems should have a backslash before the 'n' :)

    (And please ignore the mispelled words.. I was rushing ;) )

  25. riverwriter
    Posted 10 years ago #

    After I typed this, I came to realize that maybe you should just skip to the final paragraph, then if you want to, you can read the rest to see the rationale.

    I have the new code up, and it certainly makes me rethink the premises of my original "outrageous" request. I see now that using all the categories complicates the problems immensely if we are trying to distinguish between poetry and prose; for example, a poem is categorized as creative writing, so when it is listed under creative writing, along with , say an essay, which is also creative writing, they both come off as prose, and we have no way to differentiate. I think that differentiation in that case is actually too complicated.

    Another issue is that when the poetry category or any category listed in the array for slashes etc come up, the depiction in the final result comes out with the line-breaks in, so that the slash is not needed. To clarify: here is poetry correctly quoted with line breaks:

    blah blah blah,
    blah blah blah,
    blah blah blah. . . — no quotation marks, no slashes needed.

    here is poetry correctly quoted without line breaks: "blah blah blah, / blah blah blah, / blah blah blah . . ." — the slashes show the line breaks, which are needed because the line breaks are significant in poetry, unlike prose.

    This is sort of like the use of the apostrophe. So many people misuse it that it is safer not to use it than to use it.

    Conclusion: I really like the control over the number of words in prose — that comes off really well. I like the way the actual poetry categories can be set to show the line breaks; I think if all entries showed line breaks, not just poetry, that would solve everything, and the slashes would not be needed. All one would have to do to make it work reasonably would be to reach a reasonable compromise between number of words and amount of poetry and prose one wants to show. So: no slashes, yes line breaks, yes word count. Does that make sense?

  26. Aleister
    Posted 10 years ago #

    You are making this difficult.. j/k ;)

    Well when the script shows the data based on the number of words, line breaks are not kept in tact the way they are with the line count method. That is why it is tricker to do both.

    You could try this..

    Clear the array for the cats which will use slashes and count by lines (easier then removing the code for that functionality right now):

    $t_break_cats = Array('');

    Then change this line (at the bottom of the ddsg_get_content function):

    return $t_output;

    to this:

    return nl2br($t_output);

    And _hopefully_ it should keep the breaks in place by transforming them into useable ones while still counting the words. :)

  27. riverwriter
    Posted 10 years ago #

    — and the result is:
    Fatal error: Call to undefined function: n12br() in /home/riverwri/public_html/wordcurrents/wp-content/plugins/dd-sitemap-gen5.php on line 671

    ulp! ;)

    I'll change that line back and see what it looks like with the Array empty.

  28. riverwriter
    Posted 10 years ago #

    Fortunately, I have kept every revision with a slightly different filename. What we have posted now is the result of posting with a blank Array. It serves the purpose. We can tweak this until the cows come home, and I certainly appreciate all the work you are putting into this, but surely you have a life — and I am starting to feel as if I am condemning you to push this giant rock uphill eternally . . . ;)

    BTW: I really like the addition of the elipses and the curly quotes.

  29. Aleister
    Posted 10 years ago #


    I am not sure if that latest code change will even help much, but for the record - nl2br (that is NL not N1 :)

  30. riverwriter
    Posted 10 years ago #

    Aside from the second entry "Guess who?" (the Star Trek survey results), which looks a little extended, the rest looks very much the way I envisioned in my original "outrageous" request. I think I will tinker with the prose word length a bit, and that's it.
    Excellent. Brilliant — as the Brits say.
    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic