tosca30
Forum Replies Created
-
Forum: Plugins
In reply to: [Media Library Assistant] Using tax_query parameter in do_shortcodeIt seems that the problem comes from using a variable as a parameter in the
do_shortcode
statement.
I don’t know how to pass this parameter:tax_query=$my_tax_query
; the use ofsprintf
only returnsArray
, and that causes the error.Forum: Plugins
In reply to: [Media Library Assistant] Field-level markup parameters with linksThanks a lot for having provided this complete example.
I have made a few modifications:
– initialize the$term_links
array in the firstforeach
loop, as each new taxonomy-term of an item was added to the previously computed (1 line for the 1st, line 1 and 2 for the 2nd, etc)
– add aget_site_url()
to the links, as my site is not at the root
– suppress the comma after each term.So, here is the final code I’m going with:
/* * Our third example changes taxonomy terms into links to term-specific archive pages. */ if ( 'term gallery' == self::$shortcode_attributes['my_filter'] ) { /* * Use the "my_href" parameter to link to a static page, * passing the taxanomy and term as query arguments. */ if ( isset( self::$shortcode_attributes['my_href'] ) ) { $my_href = self::$shortcode_attributes['my_href']; } else { $my_href = ''; } /* * Collect non-empty term lists, convert to slugs, * make into links, replace $item_values */ foreach ($item_values as $key => $value ) { if ( ( 'terms:' == substr( $key, 0, 6 ) ) && ( ! empty( $value ) ) ) { $taxonomy = substr( $key, 6 ); $terms = array_map( 'trim', explode( ',', $value ) ); $term_links = array(); foreach( $terms as $term_name ) { $term_object = get_term_by( 'name', $term_name, $taxonomy ); if ( empty( $my_href ) ) { $term_links[] = sprintf( '<a href=%1$s/%2$s/%3$s>%4$s</a>', get_site_url(), $taxonomy, $term_object->slug, $term_name ); } else { $term_links[] = sprintf( '<a href=%1$s/%2$s?my_taxonomy=%3$s&my_term=%4$s>%5$s</a>', get_site_url(),$my_href, $taxonomy, $term_object->slug, $term_name ); } } $item_values[ $key ] = implode( ' ', $term_links ); } } return $item_values; }
I want to use the same archive page whatever taxonomy is being called, so I’ll probably go for a regular
archive.php
for the whole site (it’ll also be called from a customized search form) and won’t use themy_href
parameter.
In fact, that is precisely the reason for my other question: Using tax_query parameter in do_shortcodeForum: Plugins
In reply to: [Media Library Assistant] Using tax_query parameter in do_shortcodeI just saw that I’d forgotten to put the relation parameter.
New tax_query:array ( 'relation' => 'AND', 0 => array ( 'taxonomy' => 'lieu', 'field' => 'slug', 'terms' => 'nasbinals', ), 1 => array ( 'taxonomy' => 'cadrage', 'field' => 'slug', 'terms' => 'plan-large', ), 2 => array ( 'taxonomy' => 'traitement', 'field' => 'slug', 'terms' => 'couleur', ), 3 => array ( 'taxonomy' => 'tag_perso', 'field' => 'slug', 'terms' => 'golden-hour', ), 4 => array ( 'taxonomy' => 'attachment_category', 'field' => 'slug', 'terms' => 'paysages', ), 5 => array ( 'taxonomy' => 'attachment_tag', 'field' => 'slug', 'terms' => 'aubrac', ), )
but still the same error message.
Forum: Plugins
In reply to: [Media Library Assistant] Using tax_query parameter in do_shortcodeI’ve modified my tax_query, that is now:
array ( 0 => array ( 'taxonomy' => 'lieu', 'field' => 'slug', 'terms' => 'nasbinals', ), 1 => array ( 'taxonomy' => 'cadrage', 'field' => 'slug', 'terms' => 'plan-large', ), 2 => array ( 'taxonomy' => 'traitement', 'field' => 'slug', 'terms' => 'couleur', ), 3 => array ( 'taxonomy' => 'tag_perso', 'field' => 'slug', 'terms' => 'golden-hour', ), 4 => array ( 'taxonomy' => 'attachment_category', 'field' => 'slug', 'terms' => 'paysages', ), 5 => array ( 'taxonomy' => 'attachment_tag', 'field' => 'slug', 'terms' => 'aubrac', )
and am trying to display the gallery with this:
echo do_shortcode(sprintf('[mla_gallery tax_query="%s" paged=current]', $my_tax_query));
but I still get the message:ERROR: Invalid mla_gallery tax_query = ‘Array’
I didn’t find any example with a
tax_query
parameter, so I don’t know what it still wrong.Forum: Plugins
In reply to: [Media Library Assistant] Tag cloud as a hierarchical listIn fact, this doesn’t seem so important as I’ll probably write my own code to display a general index for the whole gallery.
Forum: Plugins
In reply to: [Media Library Assistant] IPTC imported in description rather than captionI just sent you a message via your contact form.
Forum: Plugins
In reply to: [Media Library Assistant] IPTC imported in description rather than captionSome problem in the two procedures (upload and “Map IPTC/EXIF Metadata”).
Here are the IPTC of one of those files (printed from my hardisk, before upload):
exiv2 -pi 140308-2807.jpg Iptc.Application2.Program String 7 digiKam Iptc.Application2.ProgramVersion String 5 3.5.0 Iptc.Application2.DateCreated Date 8 2014-03-08 Iptc.Application2.TimeCreated Time 11 18:05:50+00:00 Iptc.Application2.Byline String 21 Marie-Noelle Augendre Iptc.Application2.Copyright String 56 Reproduction et utilisation interdites sans autorisation Iptc.Application2.Keywords String 12 Golden hours Iptc.Application2.ObjectName String 22 Vacheries de Cartayrel Iptc.Application2.Caption String 51 Au col de la Matte, entre Sainte Urcize et Laguiole Iptc.Application2.Keywords String 7 Couleur Iptc.Application2.Keywords String 5 Hiver Iptc.Application2.Keywords String 8 Montagne Iptc.Application2.Keywords String 11 Golden hour Iptc.Application2.Keywords String 10 Plan large Iptc.Application2.Keywords String 13 Sainte-Urcize Iptc.Application2.Keywords String 6 Aubrac Iptc.Application2.Keywords String 14 Format paysage
IPTC/EXIF mapping settings are as follow:
Title : 2#005
Caption : 2#120
but the caption remains empty whatever I do, and the description gets the 2#120 field instead.I don’t remember having had this problem with the previous pictures I had worked with.
One thing is different, though. I have this message when uploading, or remapping:
Warning: exif_read_data(140308-2807.jpg): corrupt EXIF header: maximum directory nesting level reached in /homez.110/marienoe/www/cevennes/wp-content/plugins/media-library-assistant/includes/class-mla-data.php on line 4612
I’ve sometimes seen this message in other programs with some pictures, but it didn’t seem to prevent them from being treated properly.
I can print the whole EXIF/IPTC data if you like, or send one picture to you.
Forum: Plugins
In reply to: [Media Library Assistant] Taxonomy term mapping only if term already existsGot it!
Here is my code, in case it could be of some interest for someone else:
public static function mla_mapping_iptc_value_filter( $iptc_value, $setting_value, $post_id, $category, $attachment_metadata ) { $new_iptc = array(); if ( $iptc_value && taxonomy_exists( $setting_value ) ) { foreach ( $iptc_value as $term) { if ( term_exists( $term, $setting_value ) ) { $new_iptc[] = $term; } } } return $new_iptc; } // mla_mapping_iptc_value_filter
Thank you very much for the great help.
I’ll go on with some other customization and will ‘ring’ again for help if I get stuck elsewhere.Forum: Plugins
In reply to: [Media Library Assistant] Taxonomy term mapping only if term already existsI’m back working on my IPTC mapping.
As per you suggestion, I intend to use the WP function
term_exists()
in order to check whether each term exists in a specific taxonomy.
However, I didn’t succeed in displaying data in yourmla_mapping_iptc_value_filter
function:
– I cannot find where theerror_log
function displays the information (I’m using a mutualized hosting service)
– and PHPvar_dump
, which I use quite often in frontend, doesn’t seem to work in backend.Is there another way to get the data structure and content?
Thanks for any hint.Forum: Plugins
In reply to: [Media Library Assistant] Taxonomy term mapping only if term already existsThank you very much for your answer.
I won’t have much time to investigate in the few coming days, but will look at your solution before the end of the week and let you know if I need some more advice.I’m already amazed by the results I’ve been able to produce with only shortcode parameters and some content template modifications.
What a great and very well designed plugin!