WordPress.org

Forums

Is it possible to do this with custom fields? (4 posts)

  1. demonboy
    Member
    Posted 6 years ago #

    Hi all,

    I'm almost ready to start migrating my old log entries but before I do I want to get my custom fields set up correctly. One feature on my current homepage displays all the places I have visited in a region in a country (you can see it on the right-hand side in a blue box - http://www.followtheboat.com). I had to build the thing manually but this time, with the magic of WordPress, I'm sure I could do it automatically with custom fields. But how?

    It has to display the 'tree' in country alphabetical order, followed by region alphabetical order followed by the location in alphabetical order. For example:

    Country A
    - Region A
    - Location A
    - Location B
    - Location C
    - Region B
    - Location A
    - Location B

    Country B
    - Region A

    Clicking on the country will bring up all locations under the regions. Clicking on the region will bring up all locations.
    Clicking on locations will display all entries tagged with that location.

    Using the custom fields is one thing, but I don't know how one breaks the parent up to show the child, alphabetically.

    Any help greatly appreciated!

    [Sorry, I should have used ul to style my list so apologies for flat structure.]

  2. Dgold
    Member
    Posted 6 years ago #

    WP doesn't automatically nest them parent-to-child (AFIK). Each custom field is on the same level. You'll have to do little custom coding tricks to make it "look" like it's falling under a higher level.

    On the other hand, WP *does* automatically do that with Categories. So if you wanted to do it with categories, it might be a bit easier to have the parent and the childen under it, and be able to check the appropriate boxes for each Post from a location.

    But yeah, if u do it w/ custom fields, just search and study. First the Codex, all articles about Custom Fields. Next, this forum, all the threads about how to "sort posts by a custom field". Then deeper, how to sort posts by presence of 2 custom fields.

    Also look at the plugin "AZIndex", that might help.

    The plugin Custom Fields Templates might help with your backend, for entering the data

    You need to first work on being able to display the total list. That's more to do with your functions and PHP query. Later you can work on making it "drop down" when you click it, as that can be done with more CSS or java.

    If you've built something like this manually on another platform, you'll have no problem. :)

    http://codex.wordpress.org/Using_Custom_Fields

    http://englishmike.net/azindex-plugin/

    http://wordpress.org/extend/plugins/custom-field-template/

    enjoy

  3. demonboy
    Member
    Posted 6 years ago #

    Thanks for the AZIndex Plugin. I've just had a cursory glance through the site and it could be the answer, though I do prefer coding myself so I have complete control over it. Still, it looks like a very powerful tool.

    It's the splitting up of parent, or nesting, that I'm unclear of. In a previous post I asked if it's possible to show the first three excerpts of my log, with the first and second excerpt divided by a random image. I received no replies and ended up cheating using two bits of code to create the two sections between the random image. I won't be able to do that with this idea though.

    I'm not convinced the solution is using Categories as it confuses the way I document my posts. It could be done but I think I'll look into the plug-in you suggested first. Thanks once again for the heads up.

  4. demonboy
    Member
    Posted 6 years ago #

    Hi all

    It's a month since I posted this query and I've still not found the answer. Is there anyone out there who can help? The azindex plug-in does not help with my problem.

Topic Closed

This topic has been closed to new replies.

About this Topic