WordPress.org

Ready to get started?Download WordPress

Forums

Matt's Community Tags - installation instructions? (32 posts)

  1. Hannes
    Member
    Posted 4 years ago #

    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.

  2. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    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; ?>
  3. Jimmy
    Member
    Posted 4 years ago #

    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)

  4. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    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

  5. Jimmy
    Member
    Posted 4 years ago #

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

  6. Jimmy
    Member
    Posted 4 years ago #

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

  7. Jimmy
    Member
    Posted 4 years ago #

    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?

  8. Jimmy
    Member
    Posted 4 years ago #

    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.

  9. Jimmy
    Member
    Posted 4 years ago #

    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/

  10. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    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.

  11. Jimmy
    Member
    Posted 4 years ago #

    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.

  12. Jimmy
    Member
    Posted 4 years ago #

    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.

  13. Jimmy
    Member
    Posted 4 years ago #

    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.

  14. shaneholden
    Member
    Posted 4 years ago #

    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!

  15. shaneholden
    Member
    Posted 4 years ago #

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

    Thank you!!!

  16. Jimmy
    Member
    Posted 4 years ago #

    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?

  17. shaneholden
    Member
    Posted 4 years ago #

    Perfect man! Thank you so much!! :)

  18. Jimmy
    Member
    Posted 4 years ago #

    Hey again, I made a public draft available now, read it here:

    http://jimmymalmqvist.com/2010/05/matts-community-tags/

    I was pretty tired while writing it, and I had some red wine also, so be gentle with me :)

    Hopefully this will get you on the right way.

  19. shaneholden
    Member
    Posted 4 years ago #

    Thank you soo much!

  20. Jimmy
    Member
    Posted 4 years ago #

    Your welcome!

    Was the guide OK? Did everything work out for you?

    If so, please spread the word =)

    Any changes you want me to make in the guide, please comment about it.

  21. shaneholden
    Member
    Posted 4 years ago #

    The guide was great! I did it on a local install and it worked flawlessly. I'll be putting it to use on my real site in the next few days :) Thank you again!

  22. Jimmy
    Member
    Posted 4 years ago #

    Glad I could help :)

  23. jaketone
    Member
    Posted 4 years ago #

    The above help was working great until I upgraded to WordPress 3.0 RC2... Now the taxonomy-people.php doesn't return any found posts.

    It appears the new default query includes :
    post_type=private
    if not otherwise specified.

    Added this to the taxonomy template code:
    "post_status" => publish

    so it now reads:

    query_posts(
    	array_merge(
    		array('posts_per_page' => 30,  "post_status" => publish),
    		$wp_query->query
    	)
    );

    It's working again.

    Thanks.

    My site:
    http://www.toolsonadventures.com/person/tyler-2/

  24. jaketone
    Member
    Posted 4 years ago #

    <deleted>

  25. Jimmy
    Member
    Posted 4 years ago #

    Thank you, that works with 3.0 now that WordPress has been updated.

    Added it to my guide as well:

    http://jimmymalmqvist.com/2010/05/matts-community-tags/

  26. jaketone
    Member
    Posted 4 years ago #

    Another problem I'm having, and anyone with WP 3.0 I presume, is 'pagination' with photos. If you were to goto page 2 of all the photos "jake" is tagged in, I get "not found errors".

    http://www.toolsonadventures.com/person/jake/page/2/

    Jayem82, I've noticed you have this same problem too.
    http://jimmymalmqvist.com/person/jimmy-malmqvist/page/2/

    Infact, Matt Mullenweg was having the same problem on his page that is until he redid his site's theme and apparently fixed it.

    I have no idea what to do to fix pagination for this as pagination on all other terms works (tags, categories, archives, etc).

  27. Jimmy
    Member
    Posted 4 years ago #

    Yes, I've noticed the problem now.

    I don't have a solution for it yet, maybe someone will drop by here and kindly help us soon :(

  28. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    I just notice that 'nopaging' => true was my solution in the intrum.

  29. Jimmy
    Member
    Posted 4 years ago #

    Yeah, but then you won't be able to browser pages right?

    Some people may be on hundreds of photos, then you might need to have a paging structure.

  30. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    Here is what is causing the issue, the taxonomy is only pulling the 'published' post status. Attachments have an 'inherit' post_status to link the settings to the file it's attached to. i.e. if a post has nom commenting then neither should it's attached files. (in theory) This is why posts can be paged if they share the taxonomy, and why attachments never show.

    Because the 1st page of a taxonomy always exists it pulls the taxonomy template file, to allow the override.

    Adding to post.php where 'inherit' is registered 'public' => true, allows it to work as expected. But is not recommended as it make all you post revisions public too as they are 'inherit'.

    I have created a ticket in Trac to have this fixed. http://core.trac.wordpress.org/ticket/14370

Topic Closed

This topic has been closed to new replies.

About this Topic