Sorting based on taxonomy terms
-
Hallo David,
thanks for your continuing work on this great plugin.
I am learning to use it with great profit every day.A couple of weeks ago I posted a question on a different thread (
I want to sort the Gallery
) and I rephrase it now.
Even before reading your suggestion, I had come out with a solution for sorting a gallery on a taxonomy term by copying the term to a Custom Field: “Anno Sociale” in my case.
My mla_gallery shortcode is
[mla_gallery mla_style=bordato mla_markup=con_titolo post_mime_type=all tipo_documento=’ritaglio-stampa’ anno_sociale=”{+template:({+request:term_slug+}|a-bad-term)+}” columns=4 …etc… ]
In order to populate the Custom Field I created a Mapping Rule
in “Media Library Assistant v2.25 Settings”.My Mapping Rule is such that the “Data Source” is [+terms:anno_sociale+]
the “Option:” is text and “Delete NULL values” is unchecked.This is working, however since the beginning I could not find a way to have the Custom Field created and populated for new attachments even though the forst two checkboxes in the Custom Fields Setting page being checked. I always have to run the “Map All Attachments” procedure of my mapping rule.
Now there is a second issue I would like to address. I would prefer to populate the Custom Field not from the taxonomy term name, but rather from the slug. That way I could provide a sort order independent of the lexycographic order of the term names
When I retrieve attachments, for example in [mla_tag_cloud] based on the “Anno Sociale” taxonomy, I can sort on the slug using orderby=slug. But in another [mla_gallery], where I don’t retrieve attachments based on the “Anno Sociale” taxonomy, and I have to use the meta_key … meta_value syntax in order to sort the results the way I need. As an example I am doing[mla_gallery mla_style=bordato mla_markup=con_titolo post_mime_type=all tipo_documento=’ritaglio-stampa’ testata_del_ritaglio=”{+template:({+request:term_slug+}|a-bad-term)+}” columns=4 meta_key=”Anno Sociale” orderby=meta_value order=DESC …etc… ]
but I am getting the output sorted by the Names of the terms that populated my Custom Field, not by their slugs.
Is there a way to write a Mapping Rule that creates the custom field the way I’d like it?Thanks David, and keep up the good work.
Guido
- The topic ‘Sorting based on taxonomy terms’ is closed to new replies.