Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter NoReason

    (@noreason)

    Thanks for the reply, 123, but that’s not what I was asking.

    I need to be able to group users in the back end, to display them in a page – I can handle the coding, but I’m looking for a plugin that will allow me to group users separate from the ‘Roles’ and display them that way.

    I would also be interested in this as a feature.

    The code in the post directly above can be copied and pasted directly into your functions.php file in your theme folder, over the section that starts with

    // Creating the content for the INDEX

    and ends with

    // End of INDEX

    That should do what you want it to. if not, drop me a line over at http://www.march1studios.com

    Just had a more competent programmer look at it and clean it up. Here’s the Index Function for the Gallery theme, cleaned up to behave like http://eric-powell.com.

    // Creating the content for the INDEX
    function remove_index_loop() {
      remove_action('thematic_indexloop', 'thematic_index_loop');
    }
    add_action('init', 'remove_index_loop');
    
    function gallery_index_loop() {
      global $post;
      /* Count the number of posts so we can insert a widgetized area */ $count = 1;
      while ( have_posts() ) : the_post() ?>
    
    			<div id="post-<?php the_ID() ?>" class="<?php
    			thematic_post_class();
    			if(function_exists('p75GetVideo')){
    		    if(p75GetVideo($post->ID)){
    				  echo " video";
    				}
    			}
    			?>">
    				<div class="entry-content">
    					<?php childtheme_post_header() ?>
    
    <?php
        $attachments = get_posts( array(
            'post_type' => 'attachment',
    		'orderby' => menu_order,
    		'order' => ASC,
            'post_status' => null,
            'post_parent' => $post->ID
        ));
    
        $first_attachement = array_shift( $attachments );
    
    	if( $first_attachement ) { ?>
    		<?php $first_img_name = apply_filters('the_title', $first_attachement->post_title); ?>
            <a href="<?php echo wp_get_attachment_url($first_attachement->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]" title="<?php echo $first_img_name; ?>"><span class="slide-title"><?php echo the_title(); ?></span>
            <img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail', $single = true)){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
    	<?php }
    ?>
    
    <span class="hide">
        <?php
            if( $attachments ) {
                foreach ($attachments as $attachment) { ?>
                	<?php $sbox_img_name = apply_filters('the_title', $attachment->post_title); ?>
                    <a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]" title="<?php echo $sbox_img_name; ?>" ><img src="<?php echo wp_get_attachment_url($attachment->ID); ?>" alt="" /></a>
                <?php }
            }
        ?>
    </span>
    				</div>
    			</div><!-- .post -->
    
        <?php comments_template();
    
        if ($count==$thm_insert_position) {
          get_sidebar('index-insert');
        }
        $count = $count + 1;
      endwhile;
    }
    add_action('thematic_indexloop', 'gallery_index_loop');
    // End of INDEX

    I may have just got it. Again – messy, so if you find a cleaner way of doing this, let me know.

    // Creating the content for the INDEX
    function remove_index_loop() {
      remove_action('thematic_indexloop', 'thematic_index_loop');
    }
    add_action('init', 'remove_index_loop');
    
    function gallery_index_loop() {
      global $post;
      /* Count the number of posts so we can insert a widgetized area */ $count = 1;
      while ( have_posts() ) : the_post() ?>
    
    			<div id="post-<?php the_ID() ?>" class="<?php
    			thematic_post_class();
    			if(function_exists('p75GetVideo')){
    		    if(p75GetVideo($post->ID)){
    				  echo " video";
    				}
    			}
    			?>">
    				<div class="entry-content">
    					<?php childtheme_post_header() ?>
    <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => 1,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	); 
    
    $attachments = get_posts($args);
    	if ($attachments) {
    	foreach ($attachments as $attachment) { ?>
    		<a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]"><span class="slide-title"><?php echo the_title(); ?></span>
                        <img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail', $single = true)){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
    		<?php }
    	}
    
    ?>					
    
    <span class="hide">
    <?php
    
    $args2 = array(
    	'post_type' => 'attachment',
    	'numberposts' => -1,
    	'exclude' => $attachment->ID,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	); 
    
    $attachments2 = get_posts($args2);
    	if ($attachments2) {
    	foreach ($attachments2 as $attachment2) { ?>
    		<a href="<?php echo wp_get_attachment_url($attachment2->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]"><img src="<?php echo wp_get_attachment_url($attachment2->ID); ?>" alt="" /></a>
    		<?php }
    	}
    
    ?>
    </span>
    
    				</div>
    			</div><!-- .post -->
    
        <?php comments_template();
    
        if ($count==$thm_insert_position) {
          get_sidebar('index-insert');
        }
        $count = $count + 1;
      endwhile;
    }
    add_action('thematic_indexloop', 'gallery_index_loop');
    // End of INDEX

    Oh wait. Okay – you haven’t quite got it yet. Neither have I.

    So far, I have this:

    <div class="entry-content">
    					<?php childtheme_post_header() ?>
    <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => 1,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	); 
    
    $attachments = get_posts($args);
    	if ($attachments) {
    	foreach ($attachments as $attachment) { ?>
    		<a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]"><span class="slide-title"><?php echo the_title(); ?></span>
                        <img class="thumbnail" src="<?php if(get_post_meta($post->ID, 'thumbnail', $single = true)){echo get_post_meta($post->ID, 'thumbnail', $single = true);} else{bloginfo('url'); echo "/wp-content/themes/gallery/images/thumbnail-default.jpg";} ?>" width="125" height="125" alt="<?php echo the_title() ?>" /></a>
    		<?php }
    	}
    
    ?>					
    
    <span class="hide"
    <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => -1,
    	'offset' => 1,
    	'post_status' => null,
    	'post_parent' => $post->ID
    	); 
    
    $attachments = get_posts($args);
    	if ($attachments) {
    	foreach ($attachments as $attachment) { ?>
    		<a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[<?php echo $post->post_name; ?>]"><img src="<?php echo wp_get_attachment_url($attachment->ID); ?>" alt="" /></a>
    		<?php }
    	}
    
    ?>
    </span>
    
    				</div>

    It’s a bit messy right now, and it’s sort of doing what it’s supposed to. It’s at least grabbing all of the images from the single post. I haven’t quite figured out how to grab the first part of the foreach, and apply the first attachment id to that first link, and then hide the rest of the attachments without creating duplicates.

    It looks like you figured it out. Care to share?

Viewing 7 replies - 1 through 7 (of 7 total)