Forums

Some advanced foreach PHP for custom a taxonomy... (4 posts)

  1. pmdci
    Member
    Posted 1 year ago #

    Hi there,

    I've been playing with PHP and WP today trying and I came to the conclusion that what I am trying to do here is beyond my PHP skills. So I came to ask you folks for advice.

    I created a post type HOTEL. Then I created a custom taxonomy called FEATURE, which I will use to display the features and facilities available for the hotels. However, I want to display these as icons.

    In the FEATURE taxonomy I added the following terms for start:

    * sauna
    * gym
    * wifi
    * bar

    What I want to do within the custom page I created to query the post types HOTEL, is some sort of for each that will do the following:

    1. Query the FEATURE taxonomy for the terms assigned to the post
    2. With the returned array, echo the html code inside a <div id="features"> to display the correct icons, which are named ico_<term-name>.png and located under /icons/ in my WP's main directory.

    For example:

    Hotel ACME has the following FEATURE terms: wifi and bar. So the html returned should be:

    <div id="features">
    <img src="/icons/ico_wifi.png" /><img src="/icons/ico_bar.png" />
    </div>

    How can I accomplish this?

    Thanks in advance for the help!

    Regards,
    P.

  2. Anointed
    Member
    Posted 1 year ago #

    Your going to LOVE this one
    http://wordpress.org/extend/plugins/taxonomy-images/

    Mfields is one amazing coder, and he always manages to understand what the user is going to need even before we do... lol

  3. pmdci
    Member
    Posted 1 year ago #

    Ohhh dude... You are THE man. Thanks for this!!! Awesome... I'll have a look and see if it suit our needs.

  4. Anointed
    Member
    Posted 1 year ago #

    @pmdci
    Just a 'heads up'
    Terminology changed in rc3.0+ in order for this plugin to continue working, you need to use the new vs.

    It's not official yet, but here is the fixed vs.
    http://wordpress.org/support/topic/409352?replies=9

Topic Closed

This topic has been closed to new replies.

About this Topic