Tagged: x
-
AuthorPosts
-
October 16, 2016 at 12:32 pm #1218347
Oliver VParticipantHello!
Everything updated and using stack Ethos1.
I am trying to understand what information is show when you load the Ethos 1 demo under the Filter by Topic option. Maybe the last posts? How many then? Maybe the most commented posts? Can you inform me, please?
In my case I would like to display the, for example, last 10 post written, and later use the Filter By Topic option to see all the possibilities and posts. How to do this? (Display the last 10 post written).
I am dealing in the child theme with the file _index.php, which I think is the one involved. Can you tell me what to change? This is the code inside the _index.php file:
<?php // ============================================================================= // VIEWS/ETHOS/_INDEX.PHP // ----------------------------------------------------------------------------- // Includes the index output. // ============================================================================= $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $categories = get_categories( array( 'include' => x_get_option( 'x_ethos_filterable_index_categories' ) ) ); $order = array(7, 2, 5, 3, 6, 4, 8); usort($categories, function ($a, $b) use ($order) { $pos_a = array_search($a->cat_ID, $order); $pos_b = array_search($b->cat_ID, $order); return $pos_a - $pos_b; }); ?> <ul class="option-set unstyled" data-option-key="filter"> <li> <a href="#"> <span class="x-index-filter-label"><?php _e( 'Filter by Topic', '__x__' ); ?></span> <i class="x-icon-chevron-down" data-x-icon=""></i> </a> <ul class="x-index-filters-menu unstyled"> <?php foreach ( $categories as $category ) { ?> <?php static $i = 1; $selected = ( $i == 1 ) ? 'class="selected"' : ''; ?> <li><a href="#"> data-category-id="<?php echo $category->term_id ?>"><?php echo $category->name; ?></a></li> <?php $i++; ?> <?php } ?> </ul> </li> </ul> <div class="x-filterable-index"> <?php foreach ( $categories as $category ) { static $j = 1; $selected = ( $j == 1 ) ? ' selected' : ''; $accent = x_ethos_category_accent_color( $category->term_id, '#333333' ); $wp_query = new WP_Query( array( 'post_type' => 'post', 'paged' => $paged, 'cat' => $category->term_id ) ); echo '<div class="x-filterable-category-group' . $selected . '" data-category-id="' . $category->term_id . '">'; if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post(); x_get_view( 'ethos', 'content', get_post_format() ); endwhile; endif; echo '<a>term_id ) . '" class="x-btn-filterable x-btn">See All ' . $category->name . ' Posts</a>'; echo '</div>'; wp_reset_query(); $j++; } ?> </div> <script> jQuery('.x-index-filters').click(function(e) { e.preventDefault(); var $this = jQuery(this); $this.parent().find('ul').slideToggle(600, 'easeOutExpo'); if ( $this.hasClass('selected') ) { $this.removeClass('selected'); } else { $this.addClass('selected'); } }); jQuery('.x-index-filters-menu a').click(function(e) { e.preventDefault(); var $this = jQuery(this); var $filter_cat = $this.data('category-id'); jQuery('.x-index-filter-label').text($this.text()); if ( ! $this.hasClass('selected') ) { $this.closest('ul').find('a').removeClass('selected'); $this.addClass('selected'); } jQuery('.x-filterable-category-group').each(function() { $this = jQuery(this); if ( $this.data('category-id') === $filter_cat ) { $this.css({ 'display' : 'block', 'visibility' : 'visible' }); $this.find('.x-btn-filterable').css({ 'display' : 'block' }); } else { $this.css({ 'display' : 'none', 'visibility' : 'hidden' }); } }); }); </script>October 16, 2016 at 3:46 pm #1218498
Oliver VParticipantHello again!
Just found this threat: #55220 I have read it and after having all the options and “problems”, I think it will be better to keep the original setting.
However, when loading oliver.ideasparatriunfar.com it only loads 6 posts, not the maximum 10. Do you know why? Should it load the last 10 post by chronological order?
Thanks!
Oliver.
October 16, 2016 at 4:06 pm #1218512
Oliver VParticipantHi again!
Just testing…
Everything is setup like just installed. Problem is:
When loading oliver.ideasparatriunfar.com displays the last posts only of the first category of the filter. I think should display the last 10 posts published, correct?
Which might be the problem?
Thanks!
Oliver.
October 16, 2016 at 6:47 pm #1218607
RadModeratorHi Oliver,
Yes it is, but you only have 6 posts under Biography category. You can confirm it here https://oliver.ideasparatriunfar.com/category/biografia/
You should assign more posts on that category.
Thanks!
October 17, 2016 at 12:41 am #1218948
Oliver VParticipantOk. I understand.
The question is: When first loading the page, it will only show the last post of the first alphabetical category? Would it be better to display the last 10 recent post, no matter category?
Thanks!
Oliver.
October 17, 2016 at 12:55 am #1218954
Paul RModeratorHi Oliver,
You can add another category called “ALL” and set all your posts to be under it.
That way when your site loads it will display your last 10 posts.
Hope that makes sense.
Thanks
October 17, 2016 at 11:58 am #1219581
Oliver VParticipantHi!
Thanks for the suggestion. I already tried to add the category ALL. Problem is that later I can not use any plugin for Related Post, which it is very important in any blog. It will not work due that all the posts are related because they have the All category.
Any other suggestions or options?
Thanks!
Oliver.
October 17, 2016 at 8:52 pm #1220209
RadModeratorHi there,
Unfortunately, there is no other solution yet. The filter is like grouping with separate query per category, and what you need to do for your requirement is to use the single query to filter them all. That requires custom coding in which we can’t cover, you may contact some developer for that tweaking. I can add this too as feature request.
Thanks for understanding.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1218347 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
