Forums » Adding Images to a Collection Description

RSS feed for this topic

Info

  1. I want to punch up Collection pages by adding images.

    Question 1:
    I've added the Featured Items thang to my theme's /collections/ PHP files. Will it pull featured items from any collection, or will it automatically limit to items in that collection? If the former, is there an easy way to hack this?

    Question 2.
    Is there a method (or a theme) that allows one to associate an image to a collection? Like Items with images, this picture would follow the Collection around. The picture would appear on the Collection's page. A smaller version of it would appear on the page for browsing collections.

    This is a similar concept to "post thumbnails" in WordPress.

    Thanks,
    Heather

  2. I am have a theme where I am working on similar functions. This is not working quite the way I would like yet, but it might give you ideas.

    Question 1: Featured Items pull items from any collection.

    I made a column on the home page to get a random featured collection (which if one could set to a specific collection), and then show 3 items from that collection.

    <!-- Featured Collection -->
    <div id="featured-collection">
    <div class="block">
    <?php echo display_random_featured_collection(); ?></div>

    <!-- Get Current Collection -->
    <?php echo get_current_collection(); ?>

    <div id="feature-items">
    <div class="items-list">
    <div class="collection-item">

    <!-- Get Items in Current Collection-->

    <h2>Items</h2>

    <?php set_items_for_loop(loop_items_in_collection(3));?>

    <?php if (has_items_for_loop()): ?>

    <?php while (loop_items()): ?>

    <!-- Display Items in Current Collection -->

    <h3><?php echo link_to_item(); ?></h3>

    <!-- Display Thumbnail -->
    <?php if (item_has_thumbnail()): ?>

    <div class="collection-img">

    <?php echo link_to_item(item_square_thumbnail()); ?>
    </div>
    <?php endif; ?>

    <!-- Display Item Description -->

    <?php if ($desc = item('Dublin Core', 'Description', array('snippet'=>300))): ?>

    <div class="description"><p><?php echo $desc; ?></p></div>

    <?php endif; ?>

    </div>
    <?php endwhile; ?>
    </div>

    <?php else: ?>
    <p>No recent items available.</p>

    <?php endif; ?>

    <!-- Link to Collection -->

    <p class="view-items-link">">View All Items</p>

    </div><!--end collection-items -->

    This is kind of bulky. I am working on a helper fu

    Question 2

    Collections aren't associated with images, only a description. It seems they are more of an organization scheme than a display function. I am working on a spared down version of the code above that just brings in an item thumbnail by id,
    then styles the .collection-description and .collection-img classes. Again this is clunky. I would like to create a function similar to display_random_featured_collection(), that would at least pull the item img into a reusable helper.

  3. I think I figured out an answer to question 2, so that an the first image of a collection will appear next to the collection description.

    <?php set_collections_for_loop(recent_collections(5)); ?>
    <?php while (loop_collections()): ?>
    	<div id="collection">
    		<div class="item">
    			<?php while (loop_items_in_collection(1)): ?>
        				<?php if (item_has_thumbnail()): ?>
        					<div class="item-img">
    			    			<?php echo link_to_collection(item_square_thumbnail(array('alt'=>item('Dublin Core', 'Title')))); ?>
    			    		</div>
        				<?php endif; ?><?php endwhile; ?>
    				<h2><?php echo link_to_collection() ?></h2>
    	        		<div class="element">
     	 	          		<div class="element-text">
    					<?php echo nls2p(collection('Description', array('snippet'=>300))); ?>
    					</div>
           			</div>
    
    		</div>
    
    		<div class="element">
                	<?php if(collection_has_collectors()): ?>
                		<h3>Collector(s)</h3>
    				<div class="element-text">
                        		<p><?php echo collection('Collectors', array('delimiter'=>', ')); ?></p>
    	           		</div>
                	<?php endif; ?>
    	 	</div>
    
    	<?php echo plugin_append_to_collections_browse_each(); ?>
    
    	</div><!-- end class="collection" -->
    <?php endwhile; ?>

Reply

You must log in to post.