I use a LearnMore Template, but it isn’t possible to add more than five articles to each category, and this is in many templates(Mywiki, IKnow, LikeAWiki &MyKnowledgeBase).
What is the code to fix this and where would I add the code on which file?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I hope you are talking about Learn More theme by Humble themes. Just downloaded this theme and checked source code.
File get_posts.php has an argument, which returns only 5 posts.
This file is located in theme folder: learnmore/inc/functions/get_posts.php
$args = array(
'orderby' => get_theme_mod( 'kb_article_orderby', 'date' ),
'order' => get_theme_mod( 'kb_article_order', 'ASC' ),
//here it goes
'numberposts' => get_theme_mod( 'kb_article_count', 5 ),
'category' => $category->term_id,
);
But I think you don’t need to change it in a source code. This theme has an options or theme page, where I see this text:
All Setting, Theme Options, Widgets and Menus are available via
Customize screen. Have a quick look or start customization!
So I recommend you to check customizer settings, you should find there an option to change the number of posts per category.
Update
how can I remove the “View all articles” sentence -under the posts-?
You can find this link in a layout-1.php file, which located: learnmore/template-parts/layout-1.php, lines 56-58. Remove this code or modify it, it’s up to you.
<a class="learnmore-category-link" href="<?php echo esc_url( get_category_link( $category ) ); ?>">
<?php esc_html_e( 'View all articles →', 'learnmore' ); ?>
</a>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0