- This topic has 9 replies, 2 voices, and was last updated 6 months, 1 week ago by
Leo.
-
AuthorPosts
-
July 14, 2020 at 9:18 am #1363357
Virve
Hi,
Can you please help me with how I can set the home page (index) of my blog to not show thumbnail and to not use infinite scroll, while keeping thumbnails and infinite scroll in archive, categories, and search results?
I would like my home page to only show one full article (without thumbnail), but archives, categories, tags and search to show excerpts with thumbnails.
Thanks!
July 14, 2020 at 11:35 am #1363477Leo
StaffCustomer SupportHi there,
Let’s do one step at the time.
Can you try first adding this PHP snippet?
https://generatepress.com/forums/topic/limit-the-number-of-post/#post-1311840Change
9
to1
.Let me know if this solves the infinite scroll issue as well 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 16, 2020 at 5:33 am #1365465Virve
Hi Leo,
Thank you for your fast reply! 🙂I inserted the suggested code into functions.php
However it did not seem to have any effect.I just realized I need to change the original plan though, since the footer needs to be accessible on all pages.
My apologies for the change of plan!The new plan:
1. Show only one full post on the Home Page, while showing 7 excerpts on the other pages (categories, tags, search). (No infinite scroll.)
2. Remove post thumbnail from the Home Page, while keeping post thumbnails on the other pages.This is the current state of my functions.php:
function generatepress_child_enqueue_scripts() { if ( is_rtl() ) { wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' ); } } add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 ); add_filter( 'generate_show_excerpt', function( $show ) { if ( is_front_page() && is_home() ) { $show = false; } return $show; } ); add_action( 'pre_get_posts', function( $query ) { if ( is_admin() || ! $query->is_main_query() ) { return; } if ( is_home() ) { $query->set( 'posts_per_page', 1 ); } } );
Thanks!
July 16, 2020 at 3:13 pm #1366121Leo
StaffCustomer SupportLet’s work on one issue at the time.
Show only one full post on the Home Page
This is working from what I can see. When I go to the home page, I only see one post titled:
Mikrokuitusieni poistaa meikin pelkällä vedelläCan you confirm?
Can you also disable the caching plugin while we are working through this?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 17, 2020 at 4:53 am #1366575Virve
Yes, that one is fixed. The front page shows only one post. (Problem is still that it also shows the thumbnail picture which I do not want to be shown there.)
I would, however, need the archive pages and search pages to show multiple posts (7) with excerpts.
Here’s an example page (category page) that only shows 1 excerpt now:
https://www.virvefredman.com/kosmetiikka/Here’s an example page (tag page) that only shows 1 excerpt now:
https://www.virvefredman.com/ostolakossa/avainsana/ihonhoito/July 17, 2020 at 8:20 am #1366910Leo
StaffCustomer SupportIs the Blog pages show at most setting set to 7?
https://wordpress.org/support/article/settings-reading-screen/#reading-settings
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 17, 2020 at 9:01 am #1366964Virve
Thank you!
I had not yet changed that to 7, since I thought that would also make the home page show 7 posts and I only wanted one post to be shown there.
Apparently that, however, worked because of some php code that was already there or something. Great that the solution was so easy.
Now my final issue is the thumbnail picture that is visible on the homepage at the beginning of the post. I want the thumbnails to stay visible on archive pages but not on the home page.
Any suggestions with this?
July 17, 2020 at 5:18 pm #1367266Leo
StaffCustomer SupportTry this CSS:
.home.blog .post-image { display: none; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/July 18, 2020 at 6:08 am #1367602Virve
Perfect, it solved the issue.
Thank you so much for all your help!
July 18, 2020 at 8:09 am #1367821Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.