Tagged: x
-
AuthorPosts
-
June 29, 2016 at 12:39 am #1064351
bedingfieldParticipantHi there,
I would like to have a page that pulls in all posts under the category of ‘race-reports’, ideally, I would also like said page to be in the ‘masonry’ format of the ‘blog’ page.
How would I do this please?
Thank you for your time.
June 29, 2016 at 2:36 am #1064433
ChristopherModeratorHi there,
Please select masonry layout Under Customize -> Blog -> Archives.
Add archive page to top navigation under Appearance -> Menus.Hope it helps.
June 30, 2016 at 12:32 am #1066202
bedingfieldParticipantHi there,
I didn’t mean an archive page. I just want one page that will display a page in the style of the masonry layout to display posts only for ‘race reports’ based on tag or category (one or the other).
Thank you
June 30, 2016 at 1:50 am #1066304
LelyModeratorHi There,
Please copy _index.php file from wp-content\themes\x\framework\views\global to wp-content\themes\x-child\framework\views\global. Open the copied file and replace the entire code with this:
<?php // ============================================================================= // VIEWS/GLOBAL/_INDEX.PHP // ----------------------------------------------------------------------------- // Includes the index output. // ============================================================================= $stack = x_get_stack(); if ( is_home() ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = is_home() && $style == 'masonry'; elseif ( is_archive() ) : $style = x_get_option( 'x_archive_style' ); $cols = x_get_option( 'x_archive_masonry_columns' ); $condition = is_archive() && $style == 'masonry'; elseif ( is_search() ) : $condition = false; endif; if ( is_category('race-reports') ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = true; endif; ?> <?php if ( $condition ) : ?> <?php x_get_view( 'global', '_script', 'isotope-index' ); ?> <div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>"> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php if ( $stack != 'ethos' ) : ?> <?php x_get_view( $stack, 'content', get_post_format() ); ?> <?php else : ?> <?php x_ethos_entry_cover( 'main-content' ); ?> <?php endif; ?> <?php endwhile; ?> <?php else : ?> <?php x_get_view( 'global', '_content-none' ); ?> <?php endif; ?> </div> <?php else : ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php x_get_view( $stack, 'content', get_post_format() ); ?> <?php endwhile; ?> <?php else : ?> <?php x_get_view( 'global', '_content-none' ); ?> <?php endif; ?> <?php endif; ?> <?php pagenavi(); ?>Then check for this part of the code:
if ( is_category('race-reports') ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = true; endif;Replace race-reports with the correct category slug of your specific category that you want to display with masonry style.
Hope this helps.
June 30, 2016 at 2:07 pm #1067151
bedingfieldParticipantThanks for this. Is it possible to have a ‘blog’ page and a ‘race reports’ page in masonry style?
Thank you
June 30, 2016 at 8:31 pm #1067673
LelyModeratorHi There,
Above code is just for the specific category. We don’t need custom codes if we want Blog index page to be masonry. It can be set in Appearance > Customize > Blog > Style > Choose Masonry. The previous suggestion by Christian will work for all archive and category pages. But then you don’t want that and you just need the specific category to be masonry. That’s the purpose of the previous code.
Hope this helps.
July 1, 2016 at 12:19 am #1067968
bedingfieldParticipantThank you.
July 1, 2016 at 1:04 am #1068003
FriechModeratorYou’re more than welcome, glad we could help.
Cheers!
July 2, 2016 at 10:09 am #1069634
bedingfieldParticipantGreat. Thank you. Its it possible to get ‘tags’ to display as masonry layout when you click on a tag?
thank you.
July 2, 2016 at 8:40 pm #1069976
Rue NelModeratorHello There,
Thanks for the updates! If you want to have a masonry layout for the tag archives, simply edit the code above and add this:
if ( is_category('race-reports') ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = true; endif; if ( is_tag() ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = true; endif;Please let us know if this works out for you.
July 3, 2016 at 7:44 am #1070314
bedingfieldParticipantGreat. Thank you. Can this work for search results as well?
July 3, 2016 at 5:41 pm #1070695
RadModeratorHi there,
Yes, you may add this along with it,
if ( is_search() ) : $style = x_get_option( 'x_blog_style' ); $cols = x_get_option( 'x_blog_masonry_columns' ); $condition = true; endif;Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1064351 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
