Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Adding static featured blogs with dynamic authors avatar on home page?


Roger Coathup
Participant

@rogercoathup

@jwack – you’ll hit some performance problems –

You’ll need to use switch_to_blog(blog_id) to change to each blog, and extract the post, author, etc. details.

Each call to switch_to_blog incurs a performance overhead.

Your alternative is to store the information you need in the activity stream when a post is saved:

Most of the information you need is already stored there for you. Take a look at the function: bp_blogs_record_activity()

You can then code a custom activity loop on your home page, that loops through activity items for new blog posts and checks whether they are in your list of featured blogs: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/

Skip to toolbar