[resolved] theme and cloud widget integration? (8 posts)

  1. alx359
    Posted 4 years ago #

    Hello again, Zach!

    After a rather bumpy road while testing/debugging/fixing some other tag/gallery plugins, I'm back again to give CataBlog a serious drive for my project. May I say the admin part for uploading and categorizing images so far has been state-of-the-art. Kudos!

    Now, I have a clear set of goals I had achieved with other plugins and now need somehow replicate with CataBlog. Namely:

    - Theme integration. Need archive.php to show a gallery depending of the category tag slug. I see there's a catablog_show_items() that seems adequate for the job, but do you have a head-start example showing the returned object, etc. and how to loop it to get the images out?

    - Need a (multi-taxonomy) cloud tag widget to show the catablog categories. Supposedly the new catablog's taxonomy 'catablog-terms' would do it or there's another way/widget?

    Thanks very much in advance.


  2. alx359
    Posted 4 years ago #

    Okay, lets start answering my own questions.

    2) The following excellent tag cloud widget seems to work with CataBlog too: [nktagcloud: Better Tag Cloud]. Just need to put [catablog-terms] as the taxonomy and it starts showing stuff from the categories. Great!

    Now need to figure our how to loop the catablog class to get the images out for the slug:

  3. alx359
    Posted 4 years ago #

    After some digging found the key piece and for the first question:

    $cb_category = $wp_query->get_queried_object()->name;
    catablog_show_items($cb_category, 'gallery');

    What I can see for now is that instead of making my own design and loop the dataset into taxonomy-catablog-terms.php, instead should create a CataBlog template and refer it as the second parameter. Cool.

    Interestingly, it seems catablog does not offer its way to get the current catalog name/slug. The above was the WP way.

  4. macguru2000
    Plugin Author

    Posted 4 years ago #


    You may also experiment with the Public feature, which will let you loop through your catalog categories with the WP loop, in fact it is exactly like making an archive.php file in your theme. Just name the file in your theme taxonomy-catablog-terms.php.

    Also read more at Update Introduces Individual Catalog Item Pages

    Good luck, and thanks for the tag cloud solution, didn't know about that one ;)

  5. alx359
    Posted 4 years ago #

    Thanks Zachs, will do. Currently I'm happy enough that with your plugin one can implement a dynamic theme gallery with just the 2 lines of code above. Fantastic!

  6. alx359
    Posted 4 years ago #

    Just for reference. That's the straightforward content of my taxonomy-catablog-terms.php to create a dynamic gallery for any slug category.

    <?php get_header(); ?>
    <div id="content-area" class="clearfix">
    	<div id="left-area">
    		//get current category name from the slug
    		$cb_category = $wp_query->get_queried_object()->name;
    		$cb_template = "gallery";
    		$cb_sort     = 'date'; //title, date, order or random
    		$cb_order    = 'asc'   //asc, desc
    		$cb_operator = 'IN';   //IN, NOT IN, AND. Default=IN
    		//populate current category from a given template
    		catablog_show_items($cb_category, $cb_template, $cb_sort, $cb_order, $cb_operator);
    	</div> 	<!-- end #left-area -->
    	<?php get_sidebar(); ?>
    </div> <!-- end #content-area -->
    <?php get_footer(); ?>
  7. alx359
    Posted 4 years ago #

    Interesting. Just noted the code above is returning up to five images and there's lot more. Shall debug tomorrow. Too late here.

  8. alx359
    Posted 4 years ago #

    The issue was with my theme (ElegantThemes). They hook to pre_get_posts and set posts_per_page as per their ePanel Number of Posts displayed on Archive pages option. The easier fix was just put -1 in there.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic