Some advanced foreach PHP for custom a taxonomy…
-
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
* barWhat 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 namedico_<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.
- The topic ‘Some advanced foreach PHP for custom a taxonomy…’ is closed to new replies.