WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Widget
Modify to List Values of a Custom Field? (5 posts)

  1. justbishop
    Member
    Posted 3 years ago #

    Title pretty much says it all...any advice on how one might go about modifying this plugin to do the exact same thing it does, but with custom fields instead of taxonomies?

  2. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Modifying this plugin may not be the best way to go. It was created specifically for taxonomies and originally forked from the Category Widget. The code you would have to write would be dependent on which custom fields need to be displayed and it's hard to give advice without know you data structure. What exactly do you need to do?

  3. justbishop
    Member
    Posted 3 years ago #

    I have a custom field key called "riotcat1". I need something that will give me a list of it's values in my sidebar, with a (n) post count beside each. I need each value linked to a page that displays posts using that custom field key.

    I'm using a custom field search plugin at the moment that creates the pages I need things linked to, but I can't get it to display a falt unordered list of the values, only a dropdown with a "go" button. That is what I have going on HERE, near the top right. I'd like the exact same functionality, but in list form in the sidebar, instead, and can't seem to find ANY way to make that happen.

    ETA: I also would not be able to use a custom taxonomy for this instead of the custom fields, because the posts that I need displayed are being pulled in from child blogs using the Sitewide Tags plugin, which will not pull custom taxonomy info, just the basic title/excerpt/content and custom fields. I understand that normal categories could work, but my child blog admins name their categories all sorts of crazy things, so I need a list of "main site categories" that they can choose from but not mess with, which is why I have it set up as a custom field key/value. I'm using the custom field template plugin to display it on each child blog's add/edit post page as a dropdown field, and a sitewide options plugin that propogates any changes I make to the child blogs' settings. I hope that made some sort of sense, lol.

  4. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    I'm using a custom field search plugin at the moment that creates the pages I need things linked to, but I can't get it to display a falt unordered list of the values, only a dropdown with a "go" button. That is what I have going on HERE, near the top right. I'd like the exact same functionality, but in list form in the sidebar, instead, and can't seem to find ANY way to make that happen.

    The first thing I would do is dig through the plugin and locate the function(s) that creates the dropdown. Roughly, it should consist of 2 parts: a query and a loop. I would copy the query verbatim and create a loop that produces an unordered list.

    I know that you probably do not want to hear this, but if I were you and there wasn't a painful amount of products on the site. I would totally switch to a custom taxonomy. IMHO it's the best route to go. It should be possible (though I've never used this plugin) to modify the Sitewide Tags plugin to be used for custom taxonomies. I've done similar things with other plugins that only worked for built-in categories. It take a bit of time, but is well worth it. You could then define a taxonomy with a fixed set of terms much like what WordPress is doing in 3.1 with post formats. Just a thought.

    Hope I was at least a bit of help :)
    -Mike

  5. justbishop
    Member
    Posted 3 years ago #

    Yeah, I've tried looking through the custom field search plugin code (THIS one), but I don't know enough PHP to pinpoint what part actually creates the dropdown. And if I did, I'm having trouble wrapping my mind around how to get links to display, since all display options currently require clicking the "go" button to actually load the linked page.

    I see what you're saying about switching early on, but the truth is that I have lots of users there on a trial basis, and some pretty stiff competition for the business I'm trying to court, so I really don't want to do something that would force people who have just invested a lot of time to learn how the system works that they are going to have to go and do it a different way now. Plus, it just seems silly to me that something that seems so simple should be so hard to accomplish, so it would eat at me forever if I just gave up on this ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic