Title: Custom Taxonomy Array
Last modified: August 29, 2019

---

# Custom Taxonomy Array

 *  [trevolutionary](https://wordpress.org/support/users/jkdsouljah/)
 * (@jkdsouljah)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/custom-taxonomy-array/)
 * I have a loop set up as follows:
 * [loop type=gazpost taxonomy=gaztype term=deptintro relation=and taxonomy_2=gazissue
   term_2=issue-1 relation=and taxonomy_3=gazdept term_3=epd]
    [content] [/loop]
 * This works no problem. However, each post that matches this criteria may also
   have assigned to it multiple identical custom fields, e.g. a post may have a 
   custom field “gazettepics”, multiple times, and in each instance, containing 
   a unique URL to an image.
 * gazettepics: imgurl1
    gazettepics: imgurl2 gazettepics: imgurl3
 * I’ve tried adding:
 * [array gazettepics]
    [field value] [/array]
 * and
 * [array gazettepics]
    [-array inner_array] [field value] [/-array] [/array]
 * I’m very clearly not doing this right, but it seems the tools are there to make
   it work… I’m just not sure how. Any help would be much appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [trevolutionary](https://wordpress.org/support/users/jkdsouljah/)
 * (@jkdsouljah)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/custom-taxonomy-array/#post-11881844)
 * After some playing, the latest I have is
 * [array]
    [field image=gazettepics in=url] [/array]
 * This returns only one result however. When I added the debug=true parameter however,
   I can see the full array for that custom field, as follows:
 * [gazettepics] => Array
    ( [0] => img_url_1.jpg [1] => img_url_2.jpg [2] => img_url_3.
   jpg [3] => img_url_4.jpg [4] => img_url_4.jpg )
 * If I were hardcoding this into the template in PHP, it’s simple:
 *     ```
       <?php 
   
       $gazpics = get_post_meta($post->ID, 'gazettepics', false);
       if( count( $gazpics ) != 0 ) { 
   
       foreach($gazpics as $gazpics) {
       echo '<a class="gazpiclink" href="'.$gazpics.'"><img class="gazpicthumb" src='.$gazpics.'></a>';
       }
       } else { 
   
       }
   
       ?>
       ```
   
 * But I need to be able to achieve the same thing using the shortcodes from this
   plugin.
 * Any help would be greatly appreciated!!!
 *  Thread Starter [trevolutionary](https://wordpress.org/support/users/jkdsouljah/)
 * (@jkdsouljah)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/custom-taxonomy-array/#post-11912946)
 * So now I am managing to output the array with simply:
 *     ```
       [loop type=gazette taxonomy=gaztype term=deptintro relation=and taxonomy_2=gazissue term_2=issue-1 relation=and taxonomy_3=gazdept term_3=epd]
       [content]
   
       [array]
       [field gazettepics]
       [/array]
   
       [/loop]
       ```
   
 * This outputs the array as a comma separated string, like so:
 * `https://example.com/IMG001.jpg, https://example.com/IMG002.jpg, https://example.
   com/IMG003.jpg, https://example.com/IMG004.jpg`
 * I’m not sure how I can turn these into images. If I adjust the [field] as follows,
 *     ```
       [array]
       [field image=gazettepics in=url]
       [/array]
       ```
   
 * it works but only retrieves the first image in the array.
    -  This reply was modified 6 years, 9 months ago by [trevolutionary](https://wordpress.org/support/users/jkdsouljah/).
 *  Thread Starter [trevolutionary](https://wordpress.org/support/users/jkdsouljah/)
 * (@jkdsouljah)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/custom-taxonomy-array/#post-11916041)
 * Couldn’t work this out, so used
 * [array]
    <div class=”pics”>[field gazettepics]</div> [/array]
 * And split the string and wrapped them in an image tag with JS/JQuery. Works well
   enough.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Taxonomy Array’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 3 replies
 * 1 participant
 * Last reply from: [trevolutionary](https://wordpress.org/support/users/jkdsouljah/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/custom-taxonomy-array/#post-11916041)
 * Status: not resolved