Tag cloud output
-
Hello, thanks for the wonderful plug-in!
I’m a beginner so I apologize in advance, but I really did try to read through a great deal of documentation to no avail.
Here’s what I want to do.
On my front page I want to have a widget in the sidebar for “Att. Tags” (Media tags). I used the WP cloud widget and the Att. Tags taxonomy, but when clicked the tags go nowhere. How do I automate where the tags lead?
Also… I would like to create a gallery page to house all my graphics, with a search box for tags at the top. How do I combine your gallery with a lightbox-type plug-in?
Thanks very much!
-
Okay, I think what I need to do is add a template to my code that will create the output for me.
Should I follow the instructions here?
http://code.tutsplus.com/tutorials/advanced-use-of-attachments-in-wordpress-creating-categorised-gallery-pages–cms-21007I am using the Sparkling theme by colorlib, it has an image.php part that says it’s for dealing with attachments. Could I just put some code in there?
I’m slowly honing in on the answer lol.
So I found this piece of code in a previous thread:
<?php $tag = $_REQUEST['attachment_tag']; echo do_shortcode("[mla_gallery attachment_tag={$tag}]"); ?> <form id="attachment-tag-form" method="get" action=""> <select name="attachment_tag" class="postform"> <option value="artisan">artisan</option> <option value="attention">attention</option> <option value="another-tag">another tag</option> </select> <input type="submit" id="submit" name="submit" value="GO"> </form>I think the option value lines could be deleted… but I’m not sure.
If I put that on a template with my theme header/footer and call it attachment_tag.php, will that suffice to create the output I require? At this point I don’t really care about anything fancy like lightbox, I just want the attachment tags to output somewhere.
Thanks for the good words and for all the effort you’ve been putting in to answer your question on your own. I know that the documentation is, shall we say, dense.
You can find quite a bit of information in this earlier support topic:
Att. Categories menu returns 404 error
As you can see, this is a common subject where the difference between pages/posts and attachments Media Library items comes up in surprising ways.
In your first post you wrote “On my front page I want to have a widget in the sidebar for “Att. Tags” (Media tags). I used the WP cloud widget and the Att. Tags taxonomy …” You can use the
[mla_tag_cloud]shortcode in any widget that accepts shortcodes. For your convenience, MLA includes the “MLA Text” widget, which accepts shortcodes and HTML markup.You wrote “Also… I would like to create a gallery page to house all my graphics, with a search box for tags at the top.” There are several examples of this basic idea in earlier topics such as:
If you go through those topics and the additional topics they link to you can find a lot of ideas on how to proceed. You can see there are two basic approaches:
- Use the shortcodes and “standard” pages to present an
[mla_gallery]with various controls for selecting the content and paging through the results. - Modify the PHP templates in your theme to get similar results.
The PHP template approach is somewhat more powerful but is more complex. I have tried to make the MLA shortcodes flexible enough to accomplish most tasks without requiring PHP code.
Finally, you mentioned a lightbox display. Here is the tip of another topic iceberg along similar lines:
I know this is a lot of information, but it will give you a much better idea of the range of possible solutions. If you can think through the options and give me a better idea of the approach you’d like to take I am happy to give you more specific guidance and work through the details of your application.
Thanks for your interest in the plugin. I look forward to hearing more about your application.
Hi David, thanks for the post. I posted this just after you….
I will read through your recommended links right away!—————
Okay… I tried to copy one of your old posts and match the header/footer stuff to the sparkling version of “search results”.
<?php /** * The template used to display Attachment Tag Archive pages * * @package sparkling */ get_header(); ?> <section id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <header class="page-header"> <h1 class="page-title"><?php printf( __( 'Attachment Tag Archives: %s', 'sparkling' ), '<span>' . $_REQUEST['attachment_tag'] . '</span>' ); ?></h1> </header><!-- .page-header --> <?php /* Start the Loop */?> <?php $tag = $_REQUEST['attachment_tag']; echo do_shortcode("[mla_gallery attachment_tag={$tag}]"); ?> <?php sparkling_paging_nav(); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </main><!-- #main --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>Thought that would do the trick but no dice.
Good luck with your studies!
One of the problems with the PHP template approach is that it is very theme-dependent. My examples are based on the “Twenty Twelve” theme that comes with WordPress. Adapting them to other themes can be straightforward to quite complex.
I searched for sparkling and found Sparkling, By Silkalns in the Repository; is that the theme you are using?
If you decide you must use the PHP approach I might be able to give you some help, but I am much better at plugins than themes; more a plumber than a painter.
Sorry, yes, that is the exact theme I am using.
I would LOVE to be able to figure this out using plugins but I spent most of yesterday and today trying to find one that would do this seemingly simple task. Every media manager I tried out seemed to just use tags, and not attachment tags, which is not at all what I want.
If there is a simpler solution than adding a new PHP template I am all ears. You can check out the site as it is right now http://www.letsnba.com
I just want those “graphics” attachment tags to output the right content (the tagged attachments).
Sorry for hogging your time π
Phew, I finally found the relevant code!
David, this is an amazing plugin and I’m going to make a donation, but I humbly request that you make a Dummies Guide, or at least put the following pieces of code right up front in the FAQ or something.
<h3>The Cloud</h3> Click on a term to populate the gallery below. [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_href="{+page_url+}?term_slug={+slug+}"] <h3>The Gallery</h3> [mla_gallery attachment_category="{+template:({+request:term_slug+}|a-bad-term)+}" mla_nolink_text="Nothing to show."]And the search form, which I edited a bit, but you can put a standard one somewhere.
<form id="mla-search-form" action="." method="post"><input id="mla-search-box" name="search-string" type="text" value="" /> <input id="submit" name="submit" type="submit" value="GO" /></form> [mla_gallery post_mime_type=all post_parent=all s="{+template:({+request:search-string+}|a-bad-term)+}" mla_nolink_text="No pages to show." posts_per_page=12 mla_output="paginate_links,prev_next" mla_link_href="{+page_url+}?search-string={+request:search-string+}"] [mla_gallery post_mime_type=all post_parent=all s="{+template:({+request:search-string+}|a-bad-term)+}" mla_nolink_text="Enter a search value above to display gallery." posts_per_page=12]You’ll save both your users and yourself a TON of time if these two pieces are somewhere everybody can see them.
I put both these onto my site and they did what I was looking for. I can’t put the tag cloud in my sidebar but that’s not a huge deal.
Then I installed Responsive Lightbox and it worked perfectly with the above code, such that I literally didn’t have to do anything to have cool lightbox effects for the gallery output! So sweet.
So basically I have one final question:
How do I change the color of my tags in my tag cloud? I think it involves style markups but if you could show me an example that’d be great.
Cheers!
Thanks for your updates with the good news!
After my earlier response I independently came to the same conclusion you did; these examples should be added to the Documentation tab to save others much time and trouble. I will do that for my next MLA version.
You noted “I can’t put the tag cloud in my sidebar but that’s not a huge deal.” That should be possible – can you say more about why you abandoned it?
You asked “How do I change the color of my tags in my tag cloud?” There is no explicit
[mla_tag_cloud]parameter for this but you can use themla_link_classparameter to add a class name to your links, then use CSS styles to change the color. You can put the styles right in your post/page; for example:<h3>The Tag Cloud</h3> Click on a term to populate the gallery below. <style type="text/css"> .color-me { color: #FF0000; } </style> [mla_tag_cloud taxonomy=attachment_category number=0 mla_link_class="color-me" mla_link_href="{+page_url+}?term_slug={+slug+}"]If you want different colors based on the size of the link or other link-specific styles you can use one of the hooks provided by the shortcode to do that. If that is of interest, let me know and I can give you an example.
I am marking this topic resolved, but please continue updating it if your have problems or further questions regarding the “cloud and gallery” combination.
Hi David,
thanks again for your help. You have indeed resolved my issue and I have made a small donation to Fair Trade Judaica in appreciation of your time.
The colors example would be another good example for your “Dummies Guide” π Thanks!
I abandoned the sidebar widget because the output appeared inside the widget instead of on another page, and it was too much hassle to figure out how to code it so the output would be on its own gallery page. I just made a gallery page with “Cloud/Search/Gallery” functions that looks pretty solid to me.
………..
I think that type of functionality would be useful for other objects too. I’m trying to do the same thing for links leading offsite, whereby I tag the links and then create the same kind of “Cloud/Search/Output List”. If you have a second I’d love to hear your thoughts.
The “Link Library” editor allowed me to attach link_category(ies) to my links, but figuring out how to get the output right is the tricky part again.
Since you have working code it might be worth considering whether the same functions could be applied to links or anything else. That combination of visual cues from a cloud plus a search form is pretty user-friendly.
Thanks again for your help, it is very much appreciated.
Hi David,
Is tag cloud available in dropdown select list?
Thanks,
SaraSara,
Thanks for you question, which has come up before in this topic:
My response back then was:
In the current MLA version (and the Development Version) there is no shortcode or [mla_tag_cloud] parameter that will generate a dropdown or other control that represents the hierarchy for a taxonomy such as Categories or Att. Categories. I did some preliminary work on one, but the WordPress developers are working on some enhancements that will significantly change the way these functions are handled and I am waiting to see what they do.
Sadly, the WordPress project seems to have died out and I am still waiting for the promised updates. I have done no further work on a dropdown select list in the interim. I may get back to this feature after I finish up some other planned work, but I cannot promise any progress in the near future.
I regret the news is not better, but thank you for the question and your interest in the plugin.
- Use the shortcodes and “standard” pages to present an
The topic ‘Tag cloud output’ is closed to new replies.