douzi1350
2016-11-26 15:22
浏览 42
已采纳

如何在wordpress中对image_meta值执行查询?

In my site I have the next code snippet:

<span class='legenda'>
<?php _e('Artist:','twentytwelve_child');?>
</span>
<?php printf ( ' ' . $metadata[image_meta][credit]);?>

The last piece [credit] give me the name of the artist.

Please can anyone tell me how to turn the outputted artist name into a query that searches the WooCommerce product database and show me all the products for that artist?

EDIT: In every image is default some IPTC/EXIF data stored. With the following code line I retrieve the data from the array [image_meta]. <?php $filedimensions = wp_get_attachment_metadata( $post_thumbnail_id, FALSE ); ?>

In this array is a field [credit] what holds the name of the Artist. See screenshot. enter image description here

The name (in this case Adrie Oosterwijk) must be turned into a link. After clicking an archive page has to be shown with all the images from (in this case) Adrie Oosterwijk. So I have to find a way to query all of this [credit] fields and return all images from the respective Artist.

EDIT 2 Eleborate on my comments:

Concerning the search remark: When on the admin dashboard I click on the products tab. Here I see the products listed with the respective taxonomies. On the top-right is a search field to searc the products, for instance by category or tag. However when I search on the taxonomy Photographer (I renamed artist to Photographer (see screenshot below),

enter image description here

it returns no results. (see screenshot below)

enter image description here

Any idea why this is happening?

Concerning the translate remark: I'm using WPML for the translation of my site. At this moment there is English as default language and Dutch as second one. When I add a product the Photographer (or artist as we called it at first) is perfectly added to the Custom Taxonomy 'photographers'. However when I translate the product from English to Dutch and try to translate the Taxonomy Photographer, what by the way shouldn't be nesaccery because it concerns personal names, the taxonomy name is not listed by WPML (see screenshot below)

enter image description here

The behavior of taxonomy translation is shown at the products->edit screen See screenshot below.

enter image description here

As we can see the Taxonomy 'Photographers' is listed but the handling is set to Do Nothing. Normally it is set to Copy. However Copy is not visible here and therefor can't be selected. It would be great when it is set to Copy by default.

At this moment when I list the products for the Dutch language the taxonaomy Photographers remain empty.

Any idea on how to adddress this two things?

2条回答 默认 最新

相关推荐 更多相似问题