Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Replace BP blog-avatar with a Latest Post Thumbnail in blogs-loop.php


  • Nahum
    Participant

    @nahummadrid

    Is it even possible? Anyone seen anything similar to get me started on the right track.

    been away from here for awhile, easing my way back to these forums, so I thought I challenge myself with this idea to get me motivated again. :)

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

  • @mercime
    Participant

    @mercime

    @nahummadrid In general, template files used:
    1. index.php file – move link to author into post meta then replace the author-box div with your new post thumbnail div
    2. functions.php – add support for post thumbnail
    3. theme’s stylesheet – add styles (e.g. float: left;) to your post thumbnail div and margin for your post title, post meta and post content
    4. (optional) archive.php, tags.php, category.php, search.php etc.

    WP Codex – https://codex.wordpress.org/Post_Thumbnails
    Old Tuts, good reference – http://www.kremalicious.com/2009/12/wordpress-post-thumbnails/
    Another tuts – http://nenuno.co.uk/creative/wordpress/adding-post-thumbnails-to-wordpress-3-0/


    Nahum
    Participant

    @nahummadrid

    @mercime thanks for replying…..just read back my poorly written post. yes it has been a while please forgive.

    Not the blog’s loop, I meant to say the blogs-loop.php ( the site tracking directory ) for multisite.

    I’m wanting to replace the bp_blog_avatar with a post thumbnail belonging to the bp_blog_latest_post.


    @mercime
    Participant

    @mercime

    @nahummadrid Yeah, I was kinda surprised you asked about a blog’s post thumbnail since I’ve seen you doing more advanced stuff. Thanks for adding “in blogs-loop” to the topic title now lol.

    Re: Thumbnails for latest posts per blog in Blogs Directory
    – last time I did this was early 2011, I installed https://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/ and it supported post thumbnails. Best place to ask advice and support re this plugin is at the WP Multisite forums https://wordpress.org/support/forum/multisite and just add tag wordpress-mu-sitewide-tags on the sidebar :-)


    Nahum
    Participant

    @nahummadrid

    @mercime thanks again. I decided not to go the sitewide forums. :) I’ve not gone there in a while either.

    Anyway here’s what I got so far, anyone welcome to help edit it. I figure If i’m able to get the image, we can also get the latest_post’s real author since blog-avatar doesn’t make much since on sites with multiple authors.

    ` <?php
    global $blogs_template;
    global $post;
    switch_to_blog($blogs_template->blog->blog_id); ?>

    <?php $my_query = new WP_Query('showposts=1&order=DSC');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>

    <a href="” rel=”bookmark”>
    ID, ‘image’, array(‘class’ => ‘alignleft’)); */ ?>

    `

    I just fashioned this up “quickly” (took me all morning) to show images. I have to figure out how to find the right image as in fallback from a woo_image to a featured image to an inserted content image. So i’ve got my work cut out.

    I don’t know how “expensive” this all is as well, so I figure I get something to work first then we can see if it’s worth it or not or if there is a better way to do it.


    Nahum
    Participant

    @nahummadrid

    For author image…
    `<?php
    global $blogs_template;
    global $post;
    switch_to_blog($blogs_template->blog->blog_id);?>

    <?php $my_query = new WP_Query('showposts=1&order=DSC');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>

    post_author ); } ?>

    `
    mildly exciting i guess. plus i just realized the blogs-loop doesn’t recognize custom post types, bbpress posts on sites.


    @mercime
    Participant

    @mercime

    @nahummadrid that’s all right if you have 10 or so subsites.

    For installations with dozens to thousands of subsites, switch_to_blog is an expensive function and will cause performance issues. The Sitewide Tags plugin also supports custom post types and custom taxonomies – http://wpmututorials.com/plugins/sitewide-tags-update/ Good luck.


    Nahum
    Participant

    @nahummadrid

    Yea, i don’t have any sites with hundreds of subsites. All subsites are limited to 5-10 subdomains belonging to superadmin where there can be multiple authors. So the blogs directory is really just an index of all admin related sites, not so much user blogs. Do you know of any examples that have 1000s of sites, not wp.com?

    Maybe I’ll limit it to just the first 5 -10 subsites in the blogs-loop. Or just have a featured set of recently updated subsites that get the image.

    I still like the blog_avatar based on post author, you think that switching and getting author avatars is less taxing than switching and pulling latest_post image with dozens/1000s subsites? @mercime


    @mercime
    Participant

    @mercime

    == Do you know of any examples that have 1000s of sites, not wp.com? ==
    @nahummadrid Well, hundreds to thousands – The Le Monde Newspaper and Harvard Law Blogs come to mind since they’re veterans of WPMU as well. You can also check out
    https://wordpress.org/showcase/flavor/wordpress-ms/
    https://buddypress.org/showcase/

    Re sitewide recent posts –

    Here’s a plugin for multisite recent posts with avatar – https://wordpress.org/extend/plugins/diamond-multisite-widgets/ – have used this myself for home page

    Found a plugin for multisite recent posts with thumbnails Compatible up to: 3.2.1 – https://wordpress.org/extend/plugins/wp-recent-network-posts/ haven’t used this so can’t comment on it :-)


    Nahum
    Participant

    @nahummadrid

    I love diamond widgets…the shortcodes are it!

    thanks again for the reply. this is the most activity I’ve had on forums in quite some time. :)


    @mercime
    Participant

    @mercime

    @nahummadrid marking this as resolved then. See ya! :-)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Resolved] Replace BP blog-avatar with a Latest Post Thumbnail in blogs-loop.php’ is closed to new replies.
Skip to toolbar