Site logo

Archived topic

Two blogs - Masonry and "normal"

4 replies · Started by tux on February 26, 2017

Viewing posts 1–5 of 5

Hi!

I'd really like to add an additional blog with the "common layout" to my already existing masonry/tiles blog. How is this possible?

And I`d really like to add a filter to my masonry blog, so that just the blog entries connected to a certain "topic" will show up. What would be the best way to do this?

Thank you in advance!

So, let me clarify as I think I wasn't quite good in explaining what I'd like to do. Sorry, it's still difficult to explain these kind of things in a foreign language.

My front page is set to display recent posts. I want the front page to show all my posts connected to the category "front-page" in masonry style.

Then there is a second site, let's call it "Blog" which I'd like to show posts connected to the category "blog" - neither in the column-style, nor in the masonry style.

I used your linked example with "is_front_page() && is_home()" as condition. Now the front page is in masonry - perfect!

I found a snippet which I think would be necessary. It filters out all the entries which should only show up on the "Blog"

add_action( 'pre_get_posts', 'my_home_category' );
function my_home_category( $query ) { 
    if ( $query->is_front_page() && $query->is_main_query() ) { 
        $query->set( 'cat', '1'); 
    } 
}

Now, I just need to "activate" a feature, so that the "Blog" site show my posts too, instead of just the front page. I think I could apply the same code as inserted above to filter out the posts which should only show up on the other site.

Thank you again for your awesome help!

Looks like you're pretty much there!

For the "Blog" site, you could just use the built in category template?

Let me know if that doesn't work for you :)

This archived topic is closed to new replies.