Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter CHQue

    (@chque)

    Hi again,

    Please find below my shortcode :
    [mla_gallery itemtag="div" captiontag="p" post_mime_type=all post_parent=all link=file columns=1 orderby=title mla_markup="major-custom-template" my_filter="format terms" tax_query="array(array('taxonomy' => 'pays','field' => 'slug','terms' => 'regional-aoc'))"]

    I also tried with the ID rather than the slug :
    [mla_gallery itemtag="div" captiontag="p" post_mime_type=all post_parent=all link=file columns=1 orderby=title mla_markup="major-custom-template" my_filter="format terms" tax_query="array(array('taxonomy' => 'pays','field' => 'id','terms' => '66'))"]

    Finally tried to change post_parent=all to post_parent=current but nothing seems to work and I always got the following error :

    ERROR: Invalid mla_gallery tax_query = ‘terms ?’

    Thread Starter CHQue

    (@chque)

    Ok that’s stupid but surrounding my shortcode with markups even if I'm using the text editor solved my issue but now I've got ugly markup in my html. Is there another way do proceed my request other with the tax_query ?

    Plugin Author David Lingren

    (@dglingren)

    I believe you have encountered the same WordPress issue raised in this earlier topic:

    Can’t figure out how to use date_query

    Where I wrote:

    Your query is running afoul of two WordPress issues. First, the “invalid mla_gallery tax_query”. For some reason I cannot determine, if the first shortcode on the post/page contains a date query WordPress corrupts it. You can solve this issue by surrounding your shortcode with and tags, which prevents the corruption.

    When you wrote “surrounding my shortcode with markups“, did you mean <code> </code>?

    If all you want to do is filter your query by a single term on a single taxonomy, you can try the (deprecated) “simple taxonomy query”, e.g., pays='regional-aoc'. As long as your taxonomy is registered with 'show_ui' => true adding this simple parameter to your [mla_gallery] shortcode should work. If not, your first tax_query parameter looks right to me.

    Thread Starter CHQue

    (@chque)

    Hi David,

    You’re right, I found the solution on this very topic. I was surprised wordpress misunderstood my shortcode even in the “text” editor. Anyway, everything is fine now.

    Thanks

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Add custom taxonomy terms as class’ is closed to new replies.