WordPress.org

Ready to get started?Download WordPress

Forums

wp_list_cats by Alphabet? (ex. only category titles that start with "A") (25 posts)

  1. thedesigncoalition
    Member
    Posted 7 years ago #

    PLEASE HELP. URGENT! :\

    Hi Everyone,
    I have searched far and wide for a way to list CATEGORY titles (not post titles) by first letter, not a full list in alphabetic order but... a list that only displays category titles that start with "d" or whatever the desired letter.

    If you are curious of the usage, I am making an A B C D etc. nav and need it to list category titles that start with the respective letter.

    I have already found nateomedia's plugin and it is for post so it wont work. I need category titles. Perhaps the bulk of the work is done with his plugin? i don't know enough about php to say but i would think you could query the data base for category title instead of post title. but I dont know and that why i am here.

    Any help would be greatly appreciated because I am under a tight deadline here! Yikes!

  2. thedesigncoalition
    Member
    Posted 7 years ago #

    PLEASE... ANYBODY!

  3. Chris_K
    Member
    Posted 7 years ago #

  4. thedesigncoalition
    Member
    Posted 7 years ago #

    Did you read my post at all?

    "not a full list in alphabetic order but... a list that only displays category titles that start with "d" or whatever the desired letter."

  5. thedesigncoalition
    Member
    Posted 7 years ago #

    I was thinking maybe with nateomedia's plugin the code could be modified to query category titles instead of post titles but not quite sure about how to do that. any takers? Pretty please? :)

    I was hoping that there might be an easier way to get this list with something like wp_list_cats and then just make a static ABC menu

  6. thedesigncoalition
    Member
    Posted 7 years ago #

    kaf? anyone?

  7. thedesigncoalition
    Member
    Posted 7 years ago #

    hello hello hello, is there anybody out there? < pink floyd

  8. thedesigncoalition
    Member
    Posted 7 years ago #

    Ok I will give one last feeble attempt to get some feedback.

    Here is the query from nateomedia's wp-snap plugin:

    // Database query
    $wp_snap_posttitles = $wpdb->get_results("SELECT
    post_title, post_content, post_excerpt, ID, post_password FROM $wpdb->posts, $wpdb->post2cat WHERE post_id = ID AND post_status = 'publish'");

    Now couldnt you change this to query category titles instead of post titles?

  9. thedesigncoalition
    Member
    Posted 7 years ago #

    scratch that. the plugin wouldnt work for my use.

    Basically all i want, is a tag that works just like :
    wp_list_cats('')

    but to be able to specify only titles that begin with a certain letter. This is totally fiction but something like this:
    wp_list_cats('starts_with=C')

  10. thedesigncoalition
    Member
    Posted 7 years ago #

    HELP! PLEASE?

    If it can't be done will someone please say so. Anykind of feedback would be greatly aprecciated.

  11. vkaryl
    Member
    Posted 7 years ago #

    I guess no one knows.... and of course, I personally don't know definitively because it's not something I've ever needed myself; and searching (you DID search, right?) didn't apparently turn up anything for you.

    Thing is, there's no reason to require anyone to state that it can't be done. If anyone KNEW how to do it, presumably that individual would have already stepped up to your plate.

  12. thedesigncoalition
    Member
    Posted 7 years ago #

    vkaryl I never meant to offend you, I cant help feel your negativity in that post.I appreciate all the help from everyone. Any feedback is better than none. You telling you that you have never seen it makes me feel better because I have searched everywhere. Any suggestions? or Alternatives?

  13. vkaryl
    Member
    Posted 7 years ago #

    Negative only in that you've bumped a LOT the last few days.... which isn't appreciated....

    Alternatives. There's this one.... http://pericat.ca/unlock/2005/02/20/explicit-category-sort-plugin/ - I don't know if it can be tweaked to do what you want.

    Other than that, you might look at the script sites to see if an alpha sorter is available which you can make work with wp. And that might mean posting a contact link here to find someone to do this for you for pay. That may be the only way at this point to get what you need.

  14. thedesigncoalition
    Member
    Posted 7 years ago #

    Thank you vkaryl. Feedback appreciated! Sorry for the bumps. Just was expecting someone to say something like yay or nay. My apologies again.

  15. Kafkaesqui

    Posted 7 years ago #

    Ok, I've been appropriately bugged about this. ;)

    I don't see a reason wp_list_cats() can't be customized to do what's being asked of it. I have a day free tomorrow, which will give me a chance to tinker a bit and rig a solution.

  16. thedesigncoalition
    Member
    Posted 7 years ago #

    I am such a nuisance. lol I am sorry guys but don't think your work is unappreciated. I am glad you think it's do-able!

    I think alot of people would appreciate this tag for the fact that they could build menus like:

    A
    Ambrosia
    Apple
    Arkansas

    B
    Bangkok
    Borat
    Bunghole

    C
    Cat
    Copper

    or do like I am gonna do and have a nav of letters (A B C) bring you to a page that lists the categories of that letter

  17. Kafkaesqui

    Posted 7 years ago #

    Anyone with a list of categories like

    Bangkok
    Borat
    Bunghole

    deserves all the help they can get on this. :)

  18. vkaryl
    Member
    Posted 7 years ago #

    *laughing* Heh.... I wasn't going to post, Kafkaesquí.... I was biting my tongue....

  19. thedesigncoalition
    Member
    Posted 7 years ago #

    Ha!! Not really my categories. But yeah there is something wrong with me if those are the first "B" words that come to mind.

  20. Kafkaesqui

    Posted 7 years ago #

    Ok, I've put together a plugin:

    Alpha list_cats
    Download plugin | View source

    Usage:
    Once the plugin is uploaded and activated, the following two 'template tag' functions are available:

    <?php alpha_list_cats(); ?>
    Analogous to list_cats()

    <?php szub_alpha_list_cats(); ?>
    Analogous to wp_list_cats()

    The parameter list for list_cats() is the same for alpha_list_cats(), only a new final 19th (!) parameter has been added: first_char.

    Example of the new parameter used with szub_alpha_list_cats():

    <?php szub_alpha_list_cats('first_char=a'); ?>

    The value for first_char is case insensitive, so 'a' and 'A' are equivalent.

    Keep in mind this will not build an alpha-delimited nesting of all categories in one stroke, so for a complete A-Z list one must provide instances of alpha_list_cats (or, szub_alpha_list_cats) for each letter; but then this *is* PHP, so that sort of thing can be automated.

    Also, the bulk of the code is list_cats dropped into the plugin. I just did some modifyin'.

  21. vkaryl
    Member
    Posted 7 years ago #

    HAH! Cool.... Kafkaesquí proves once again that he can rise to the occasion....

    So I'm downloading it to my "kaf" folder in my "plugins" folder.... I may never need it, but eventually someone will and won't be able to find it or whatever.... It's a collectable "kaf"!

  22. thedesigncoalition
    Member
    Posted 7 years ago #

    Kaf you are a god

  23. thedesigncoalition
    Member
    Posted 7 years ago #

    Works like a dream! I'll send you a link when it goes live Kaf

  24. wonderland
    Member
    Posted 7 years ago #

    Thank you, Kafka, it works like hell!

    My Brand Library: http://wonderland.creative-assets.com/marken/

  25. thedesigncoalition
    Member
    Posted 7 years ago #

    Hey kaf , the site is still lacking content but you can see my usage here:

    http://quintessentialdisc.com/

    click on the "find an artist" button and you will see my alphabetical menu.

    Thanks Again!!!

Topic Closed

This topic has been closed to new replies.

About this Topic