• Hannes

    (@funkpunk)


    I’m using Matt’s Community Tags (http://wordpress.org/extend/plugins/matts-community-tags/) version 0.3 and I got it set up on my blog even though there were no instructions on how to install it. After a few trials and errors I figured that I had to add this code to the Image Attachment Template (image.php):

    <div id="tagthis" class="tagthis"></div>

    The form where people can submit tags is displayed under each photo. But I haven’t found a way to link to a page that displays all photos that this person is tagged on like Matt does on his blog:
    http://ma.tt/person/matt-mullenweg/

    In the comments on a blog post Matt says:
    “Final step is you need to display the tags using the_terms().”
    http://ma.tt/2008/08/community-tagging-2/

    Does anyone know exactly what code to put in? Should I just try <?php the_terms(); ?> ?

    If anybody has successfully implemented Matt’s Community Tags with all the bells and whistles like on ma.tt it would be great if you could provide some help and sample code, thanks.

Viewing 15 replies - 1 through 15 (of 31 total)
  • This is what I managed to use.

    <?php echo get_the_term_list($post->ID, 'people', 'People Tagged: ', ', '); ?>

    Then I created a taxonomy-people.php

    and used the following loop code

    <?php global $wp_query;
    query_posts(
    	array_merge(
    		array('posts_per_page' => 12),
    		$wp_query->query
    	)
    ); ?>
    
    <?php if (have_posts()) : ?>
    	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    
    		<div class="contentHeader">
    			<h3>Photos of <?php
    // Get terms for post
    $terms = get_the_terms( $post->ID , 'people' );
    
    // Loop over each item since it's an array
    foreach( $terms as $term ) {
    	// Print the name method from $term which is an OBJECT
    	print $term->name . '<br />';
    	// Get rid of the other data stored in the object, since it's not needed
    	unset($term);
    }
    ?></h3>
    			<span>
    				<?php echo term_description(); ?>
    			</span>
    		</div>
    
    <div id='gallery-1' class='gallery'>
    
    	<?php while (have_posts()): the_post(); ?>
    
    	<dl class='gallery-item'>
    			<dt class='gallery-icon'>
    				<a href='<?php the_permalink() ?>' title='<?php the_title(); ?>'><?php echo wp_get_attachment_image( '','thumbnail' ); ?></a>
    			</dt>
    				<dd class='gallery-caption'>
    				<a href="<?php the_permalink() ?>"><strong><?php the_title(); ?></strong></a><br />
    				<a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?> </a>
    				</dd></dl>
    
    	<?php endwhile; ?>
    
    <br style='clear: both;' />
    		</div>
    
    	<div id="pageNavigation">
    		<?php if(function_exists('wp_pagenavi')): ?>
    			<?php wp_pagenavi() ?>
    		<?php else : ?>
    			<span id="newerEntries"><?php previous_posts_link('Newer Entries'); ?></span>
    			<span id="olderEntries"><?php next_posts_link('Older Entries'); ?></span>
    		<?php endif; ?>
    	</div>
    
    <?php else : ?>
    
    	<p>Sorry, but there are no photos of that person.</p>
    
    <?php endif; ?>
    Jimmy

    (@jayem82)

    Nice!

    I’m playing around with the code a bit, to make it fit my blog theme.
    Just wondering about a couple of things.

    what is the form code to let visitors tag images as well?
    Is there a way to edit the tags in admin?
    How did you add description to image tag? (as you did with photos tagged with yourself)

    I don’t have an answer to the 1st one but for the second and 3rd a taxonomy has the same editing capability as a tag or theme.

    Go to this page in your admin.
    /wp-admin/edit-tags.php?taxonomy=people

    So how did you insert the option to let people tag you photos?

    Oops, missed it at the very beginning. Forget my last post!

    I got almost everything set up now, just one big problem.

    I can’t choose ‘people’ under Taxonomy when moderating tags.

    Only have the options ‘category’ ‘post_tag’. Must I add something in my theme’s functions.php?

    I played around a little bit with the matt-community-tags.php, translated to my language etc.

    Seems as i had to change line 29

    array( 'attachment:image', 'attachment:video', 'attachment:audio' ),

    I added ‘post’ som now it looks like this:

    array( 'post', 'attachment:image', 'attachment:video', 'attachment:audio' ),

    After this everything works I think.

    Nope, there are still some things I want to fix.

    I used your code, which helped me a long way. But what about this:

    <h3>Photos of <?php
    // Get terms for post
    $terms = get_the_terms( $post->ID , 'people' );
    
    // Loop over each item since it's an array
    foreach( $terms as $term ) {
    	// Print the name method from $term which is an OBJECT
    	print $term->name . '<br />';
    	// Get rid of the other data stored in the object, since it's not needed
    	unset($term);
    }
    ?></h3>

    1. How do only show one name in the title? Your code is showing all the names from the first picture in the list. See http://jimmymalmqvist.com/person/jimmy-malmqvist/ I only want to show the tag name being viewed (Jimmy Malmqvist) here. Isn’t there a simple way of doing this?

    2. Does anyone have a solution to count number of tags after name like Matt does? See http://ma.tt/2010/05/wcsf-2010-photos/mcm_5117/

    1. I didn’t realize I had that problem, heres new code to fix it.

    <div class="contentHeader">
    			<h3>Photos of <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?></h3>
    			<span>
    			<?php echo term_description( '', get_query_var( 'taxonomy' ) ); ?>
    			</span>
    		</div>

    I’m still looking for a solution for 2 but it might involve creating a new function based on get_the_term_list() Matt probably has created a custom function in his theme.

    You should not have to add ‘post’ unless you want to tag posts too, but that is one work around.

    Thx for the solution!

    I don’t know why it was like that for me, but if I didn’t add the ‘post’, I could not choose ‘people’ under Taxonomy when moderating all the tags with the plugin. It’s good to be able to tag posts as well, so I don’t mind at all.

    Now the big question is how to insert <br style="clear: both;" /> after exactly three posts in the taxonomy-people.php.

    Original code from media.php in wp-includes:

    <!-- see gallery_shortcode() in wp-includes/media.php -->
    		<div id='$selector' class='gallery galleryid-{$id}'>");
    
    	$i = 0;
    	foreach ( $attachments as $id => $attachment ) {
    		$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
    
    		$output .= "<{$itemtag} class='gallery-item'>";
    		$output .= "
    			<{$icontag} class='gallery-icon'>
    				$link
    			</{$icontag}>";
    		if ( $captiontag && trim($attachment->post_excerpt) ) {
    			$output .= "
    				<{$captiontag} class='gallery-caption'>
    				" . wptexturize($attachment->post_excerpt) . "
    				</{$captiontag}>";
    		}
    		$output .= "</{$itemtag}>";
    		if ( $columns > 0 && ++$i % $columns == 0 )
    			$output .= '<br style="clear: both" />';
    	}
    
    	$output .= "
    			<br style='clear: both;' />
    		</div>\n";
    
    	return $output;
    }

    I need the <br style="clear: both;" /> after three posts (images) shown, or else when a portrait image appears this will mess up the design since everything have float left.

    Fixed!

    Added this code before query_posts

    $style_classes = array('-1','-2','-3');
    $style_index = 0;

    Then changed the <dl class='gallery-item'> to

    <dl class="gallery-item<?php $k = $style_index%3; echo "$style_classes[$k]"; $style_index++; ?>">

    This way the will be -1, -2, -3 after gallery-item. You need to change the css to match this of course, and add clear:left to -1, like this:

    <style type="text/css">
    #gallery-1 {margin: auto;}
    #gallery-1 .gallery-item-1, #gallery-1 .gallery-item-2, #gallery-1 .gallery-item-3 {float: left; margin-top: 10px; text-align: center; width: 33%;}
    #gallery-1 .gallery-item-1 {clear:left;}
    #gallery-1 .gallery-caption {margin-left: 0;}
    </style>

    Note: I delete the border css since I’m not using it on my theme.

    I’ve been wanting to do this for a while now, and now see that Matt’s Community Tags plugin has been updated since I last tried. I’d like for it to function just like Matt’s, with it displaying the people tagged underneath the images, along w/ clicking a person’s name showing a page with all the tagged images.

    Does it now create the new custom taxonomy People, or will it need to be created? If not, other than the theme changes, what other plugins or code are you using to be able to have the people tags not thrown in with the other post tags?

    Thanks!

    Actually, do you have a step by step of how exactly you’ve achieved it on http://jimmymalmqvist.com ?

    Thank you!!!

    I guess there are more people who’d like to get it all working as Matt does, so this is what I’ll do.

    My blog is in Swedish, but I’ll write a post soon with step-by-step instructions, in English of course.

    I will write a link here when I’ve made the post, sometime in the upcoming week.

    How’s that?

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Matt’s Community Tags – installation instructions?’ is closed to new replies.