• Resolved bhasic

    (@bhasic)


    Thank you for this great plugin. It’s like wp-gallery on steroids, but also very complex. I have a couple of problems I need help with.

    I don’t understand how to make one of my categories open as default instead of displaying mla_nolink_text. Also I’m trying to make search and tag cloud work from the sidebar, but search does nothing and tags go to 404-page. This is what I have tried:

    I have installed and activated MLA UI Elements Example plugin.

    In main page area:

    [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}?term_slug={+slug+}"]
    
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" posts_per_page="12" mla_output="paginate_links,prev_next" mla_link_href='{+page_url+}?term_slug={+request:term_slug+}' mla_style=km mla_markup=km]
    
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" posts_per_page=12 mla_nolink_text="Click a term to display the gallery."]

    In sidebar MLA Text widget:

    <form id="mla-text-form" action="." method="post">
    <strong>MLA UI Tags Search</strong>
    [muie_terms_search mla_terms_taxonomies=attachment_tag mla_term_delimiter=' ' mla_phrase_connector='OR']
    
    <input id="text-form-submit" name="text_form_submit" type="submit" value="Search">
    </form>

    In another sidebar MLA Text widget:

    [mla_tag_cloud]
    taxonomy=attachment_tag post_mime_type=image
    mla_link_href="/images-by-tags/?current_id={+term_id+}"
    number=20
    smallest=8 largest=20 
    separator=' - '
    ids="{+content_items+}"
    [/mla_tag_cloud]

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter bhasic

    (@bhasic)

    Trying also to get current category highlighted with no luck. Now in the main page area:

    [mla_term_list taxonomy=attachment_category mla_output=flat show_count=true current_item="{+request:current_item+}" number=0 mla_link_href="{+page_url+}?current_item={+term_id+}&tax_input{{+query:taxonomy+}}{}={+slug+}" mla_link_class="{+current_item_class+}"]
    
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" posts_per_page="12" mla_output="paginate_links,prev_next" mla_link_href="{+page_url+}?current_item={+term_id+}&tax_input{{+query:taxonomy+}}{}={+slug+}" mla_style=km mla_markup=km]
    
    [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" posts_per_page=12 mla_nolink_text="Click a term to display the gallery."]
    Plugin Author David Lingren

    (@dglingren)

    Thanks for the positive MLA feedback and for your questions. Thanks as well for including the text of your shortcodes; very helpful.

    You wrote “I don’t understand how to make one of my categories open as default…” You can replace the a-bad-term portion of the content template with the slug of your default term to display the default gallery.

    You wrote “Trying also to get current category highlighted…“. The [mla_tag_cloud] shortcode adds an HTML class, mla_current_item, to the could item matching the current_item= value. You need to change your term_slug= parameter to current_item=. Then, you can add CSS styles to change the attributes of the item in that class. Here’s an example:

    <style type="text/css">
    .mla-flat-cloud a.mla_current_item,
    .mla-flat-cloud .mla_current_item a:visited
    {	color:#FF0000;
    	font-weight:bold}
    </style>
    <div id=mla_flat_cloud class="mla-flat-cloud">
    [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}?current_item={+slug+}"]
    </div>

    Don’t forget to change the parameter name in your two [mla_gallery] shortodes as well.

    I am not sure why you want to use a sidebar widget for the terms search function, but regardless of where the [muie_terms_search] shortcode is located you need to add an add_filters_to=any parameter to your [mla_gallery] shortcodes to have them pick up the values returned by the terms search form. See the examples in the Settings/MLA UI Elements Documentation tab for more information. Note that it is not possible to combine the cloud selection with the term search function in the same gallery display.

    I hope that gets you started on a solution. I will leave this topic unresolved for now and wait for additional information on your application goal.

    Thread Starter bhasic

    (@bhasic)

    So I have been trying to make a category cloud/term list, tag cloud and search on the same page, but there can only be one. My goal was to make it as simple as possible to upload media, so that the user would only have to write a name and select a category and tags. Then the viewer would filter and search the images while staying on one page. I guess I have to replan.

    Thread Starter bhasic

    (@bhasic)

    I will put the categories on their own pages. Is it possible to show only the tags of the images displayed in the current page and category in the tag cloud? Only the ones that are relevant to the displayed category.

    • This reply was modified 1 year, 1 month ago by bhasic.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates and your patience in awaiting my reply.

    The tag cloud and the list formats generate hyperlinks that refresh the page with specific filters when clicked. The [mla_term_list] dropdown and checklist formats generate HTML markup you can put in a form along with the MUIE elements such as [muie_terms_search].

    You can create a search form with multiple dropdown controls and search boxes that should support your application. For example, you can have a form that includes a category dropdown, a tags dropdown and a terms search text box. If that would work I can give you more specific help.

    You asked “Is it possible to show only the tags of the images displayed in the current page and category in the tag cloud?” Yes, that’s possible. You can use [mla_gallery] to select the images in a single category and then pass the IDs to [mla_term_list] or [mla_tag_cloud] to display a filtered list of tags.

    You wrote “I will put the categories on their own pages.” You could put the category cloud on the same page as the tags and gallery. The user would click on a category and then the filtered tags and gallery would appear. Are the tags just for display or are they an additional filter?

    Any additional details you can provide will help me be more specific. Thanks .

    Thread Starter bhasic

    (@bhasic)

    Generating a working hyperlink is the problem. The main page category selection link works, but I don’t understand how to get the sidebar current category + tag link to work.

    If I keep everything dynamic and on the same page, I dont know what ID to pass to [mla_term_list] or [mla_tag_cloud], because it’s up to the user what category is active.

    The search form you described would be good. The tags are to be used as an additional filter.

    • This reply was modified 1 year, 1 month ago by bhasic.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and for your patience in awaiting progress. Combining a tag cloud with term lists and search controls is problematic, but here is al alternative that uses two dropdown controls. The second, tags, dropdown only appears when a category is selected and it only contains tags assigned to items in the selected category. Play around with it and let me know what you think.

    <form id="mla-search-form" action="." method="post">
    [mla_term_list]
    taxonomy=attachment_category minimum=1 post_mime_type=image
    mla_output=dropdown mla_control_name=att_category
    mla_option_value="{+slug+}" use_filters=true
    option_all_text='Select a category' option_all_value=ignore.terms.assigned
    [/mla_term_list]
    <br />
    [mla_gallery add_filters_to=any default_empty_gallery=true post_parent=all mla_alt_shortcode=mla_term_list mla_alt_parameters="taxonomy=attachment_tag  post_mime_type=image
    mla_output=dropdown mla_control_name=current_item
    option_all_text='Select a tag' option_all_value=ignore.terms.assigned
    mla_item_value='{+slug+}' use_filters=true"
    ]
    <br />
    Keyword(s): [muie_keyword_search]
    mla_search_fields='title,excerpt,content'
    mla_search_connector='OR'
    [/muie_keyword_search]
    <br />
    Items per page: [muie_per_page numberposts=4]
    <br />
    <input id="search-form-submit" name="search_form_submit" type="submit" value="Filter">
    </form>
    <h3>Gallery</h3>
    [mla_gallery add_filters_to=any default_empty_gallery=true post_parent=all posts_per_page=4 mla_output="paginate_links,prev_next"]
    
    [mla_gallery add_filters_to=any default_empty_gallery=true post_parent=all posts_per_page=4 mla_caption="{+title+} : {+description+}" mla_nolink_text="Enter tag(s) and/or keyword(s) to display the gallery."]
    Thread Starter bhasic

    (@bhasic)

    Thanks a lot for the help. Anyway I decided to forget the tag-cloud and use a plugin for the search. Media search enhanced works great. Its search results tags just point to site.net/attachment_tag/tag/ which is empty. Would be great to make that work.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update. I’ve been working away on the custom field cloud/list feature. It’s a good project but lot of work. I am happy you have found a suitable alternative.

    Thanks for sharing the Enhanced Media Search plugin link. I always like to see media related plugins and I’ll try it out. Regarding the results tags and the empty page, I know WordPress specifically excludes media library items from their “archive pages”. I will see if the Enhanced Media Search plugin has some support for changing the links, but I am not optimistic. You could build a search form using the MLA shortcodes and go to a page with an appropriate [mla_gallery] display, but that’s more work.

    Thread Starter bhasic

    (@bhasic)

    Finally got it working. Found this and based on it got it working with

    add_action('parse_query', 'hijack_query');
    function hijack_query() {
        global $wp_query;
        if (is_tax() OR is_category()) {
            $wp_query->query_vars['post_type'] =  array( 'attachment', 'page', 'post' );
            $wp_query->query_vars['post_status'] =  array( null );
            return $wp_query;
        }
    }

    Except it’s missing pagination.

    • This reply was modified 1 year, 1 month ago by bhasic.
    Thread Starter bhasic

    (@bhasic)

    Pagination had to be enabled in theme settings.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates and for sharing the solution you found. I am happy to see it was a small bit of code and that pagination is properly handled by the theme.

    I am marking this topic resolved, but please update it or start a new topic if there is anything else I can do to help.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘MLA Text widget search and tag cloud’ is closed to new replies.