Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

image.php file for Buddypress theme (3 posts)

Started 1 year, 1 month ago by: Famous

  • Profile picture of Famous Famous said 1 year, 1 month ago:

    Does anyone have an image.php file for buddypress? One that shows cool thumbnails of next and previous images? Or can you get me started somehow? Thanks for your help.

  • Profile picture of @mercime @mercime said 1 year, 1 month ago:

    == thumbnails of next and previous images ==

    @famous next and previous thumbnail images are shown by template tags –
    <?php previous_image_link(); ?> and <?php next_image_link(); ?>

    One quick solution for an image.php file:
    - copy bp-default theme’s index.php and save to your child theme folder
    - open up index.php and replace the following lines:

    Replace

    <div class="entry">
    <?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
    </div>

    With

    <div class="entry">
    <?php echo wp_get_attachment_image( $post->ID, 'large' ); ?>
    <?php the_content(); ?>
    </div>

    Replace

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ) ?></div>
    <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ) ?></div>
    </div>

    With

    <div class="navigation">
    <div class="alignleft"><?php previous_image_link(); ?></div>
    <div class="alignright"><?php next_image_link(); ?></div>
    </div>

    Replace
    <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    With
    <h2 class="posttitle"><a href="<?php echo get_permalink($post->post_parent); ?>" rel="attachment"><?php echo get_the_title($post->post_parent); ?> </a></h2>

    You can also check out twentyten’s loop-attachment.php to see how image attachments are rendered along with other forms of attachment http://core.trac.wordpress.org/browser/tags/3.1.1/wp-content/themes/twentyten/loop-attachment.php

  • Profile picture of Famous Famous said 1 year ago:

    hello @mercime I didn’t get your reply till much later. I ended up finding what you said above:
    <?php previous_image_link(); ?> <?php next_image_link(); ?>
    And it worked great, however I have one more situation I was hoping you could help me out with. I want to click:
    <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?></p>
    the above and have it go to the next picture, instead of just showing the same image on the page only, any idea?