WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Assistant
[resolved] Using the tag cloud pagination example - how to display images only (4 posts)

  1. anita@joli.com.au
    Member
    Posted 6 months ago #

    This is certainly an impressive plugin and the documentation is excellent and the support looks super-execellent too.

    I am having a problem navigating all of the options to get exactly what I want.

    The site has lots of images which have categories and subcategories.
    Most images are stand-alone - i.e. not attached to pages or posts.

    I am using the tag cloud pagination example to try and generate a tag cloud gallery, which has an image gallery beneath it. The image gallery being filtered/selected by clicking on the tag cloud.

    The cloud is generated, but when I click on a category I get an empty search result. I think this is because the query is looking for posts, not images.

    I can generate a gallery of the type I want using this code:
    [mla_gallery category_name="rock-sample-rare-minerals-and-their-unique-textures" itemtag="li" link="file"]

    I have simplified the code (removing the pagination and retaining the search term) thus:


    mla_tag_cloud taxonomy=category number=0 mla_link_href="{+page_url+}?term_id={+slug+}"]

    [mla_gallery category_name="{+term_id+}" mla_caption="{+title+}" itemtag="li" link="file"]

    mla_debug seems to show me that the mla_gallery command is searching posts

    Perhaps I am barking up the wrong tree. How should I approach generating a tag cloud gallery of images?

    Many thanks,

    Anita Graham

    http://wordpress.org/plugins/media-library-assistant/

  2. David Lingren
    Member
    Plugin Author

    Posted 6 months ago #

    Anita,

    Thank you for your positive comments on the plugin and support, and for your question regarding the [mla_tag_cloud] shortcode. It looks like you're on the right track and close to a solution.

    First, regarding the "searching posts" confusion, let me try to explain. In the WordPress database, images/attachments/Media Library Items do not have their own table. They are stored as "posts" with a post_type of "attachment". Think of them as the first, very early example of what has become custom post types. Rest assured, your [mla_gallery] and [mla_tag_cloud] shortcodes are searching for images.

    On to your empty gallery issue. It looks like you have a minor problem with passing the term_id from the tag cloud to the gallery. In the Settings/Media Library Assistant Documentation example, you will see current_id={+term_id+} in the tag cloud link_href parameter; similar to your term_id={+slug+} parameter. In the corresponding [mla_gallery] shortcode the example calls for {+request:current_id+}, while your parameter is {+term_id+}. The "request:" prefix is the key; that's how MLA knows to look in the URL for the value.

    Try adding the "request:" prefix to your gallery shortcode; that should get you a non-empty page.

    Using the "slug" instead of the "term_id" and using the simple category_name="{+request:term_id+}" query will work, but if you have multiple category levels you will get inconsistent results. The more complex "tax_query" used in the MLA example ensures that the tag cloud and the gallery will agree on the number of images to be displayed.

    That should get you closer to your goal. Let me know if it works for you (or not). If you have any problems or further questions, post them here and we'll keep at it.

    I will leave this topic unresolved until I hear back from you. Thanks again for your interest in the plugin and for the first tag cloud support question!

  3. anita@joli.com.au
    Member
    Posted 6 months ago #

    David,

    thank you very much. My simple tag cloud gallery now appears.

    An add-on question:

    The initial call to the gallery presents the tag-cloud and no images.
    How would I change this so that I get the tag-cloud and all images?

    thanks,

    Anita

  4. David Lingren
    Member
    Plugin Author

    Posted 6 months ago #

    Anita,

    I'm happy to hear that adding the "request:" prefix solved your problem, and I'm pleased to report that your add-on question seems to have a simple fix as well.

    I assume you are still using the simple "category_name=" query, not the "tax_query=" alternative. If so, adding post_parent=all to your [mla_gallery] shortcode will get you the results you want.

    When you first display the page, "{+request:term_id+}" is not set in the URL and your query becomes category_name="". Since the value is empty, the parameter is discarded. After that, the query logic reverts to the default rule of only matching images that are attached to the current page, and there are none.

    I'm going to mark this topic resolved, but please update it if you have any other problems or questions. Thanks for the good news and for your interest in the plugin.

Reply

You must log in to post.

About this Plugin

About this Topic