Archived topic
Want to change the layout of the homepage
31 replies · Started by Mouse on May 19, 2020
How did you add the first PHP code? And is still added to the site?
PHP code in the functions.php
and the CSS code in the additional CSS in the customizer.
do you have any other custom functions added to the site ?
no its just functions.php that I can see.
Can you try adding the function to the Code Snippets plugin.
Hi there, I am not understanding. Can you log in to the website and have a look?
This document explains adding PHP:
https://docs.generatepress.com/article/adding-php/
Towards the end it provides a link to the Code Snippets plugin.
If you can test the code using the Code Snippets plugin we can determine whether there is an issue with the function or an issue within the functions.php
Hi there... I already did that too, but it's not working.
Please have a look at this link.
https://ibb.co/1bsXYcL
Here you can see I numbered 3 points. 1,2 and 3.
In 1 : In one the image is a link.
In 2 : the text is also a link which does not show completely.
In 3 : The text ends with the use of (...)
I want to make a single clickable box. So they dont link to the post seperately (which is not good for SEO). Also want the title to show fully.
And in the 3rd I want (...) to show or else it seems awkward.
What you suggested is not working. Please help me. It's been over a week now and it's very frustrating and ruining the user experience. If you can just log in the website and fix it. I will be very greatful to you. Thanks.
Hi there,
We aren't able to log in and fix this for users - sorry about that.
The posts you screenshotted are not using WP Show Posts, which is why the code is not working.
To remove links from GeneratePress featured images, you can do this:
add_filter( 'generate_featured_image_output', function() {
return sprintf(
'<div class="post-image">
%2$s
%1$s
</div>',
get_the_post_thumbnail(
get_the_ID(),
apply_filters( 'generate_page_header_default_size', 'full' ),
array(
'itemprop' => 'image',
)
),
apply_filters( 'generate_inside_featured_image_output', '' )
);
} );
To link the entire container, you can do this:
.generate-columns .inside-article {
position: relative;
}
.generate-columns a:before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
Hi... Again.. where do I place these codes?
Also How to I make the title show completely in the container?
The code starting with add_filter is PHP:
https://docs.generatepress.com/article/adding-php/
The other code is CSS:
Hi worked like a charm. Thanks.
Now Just need the titles to show fully. Right now the post titles do not show fully. Please help with that as well.
The Dispatch Site uses some CSS to trim the titles to 2 lines.
Go to Customizer > Additional CSS and delete this:
.generate-columns-container article .entry-header .entry-title,
.wp-show-posts article .wp-show-posts-entry-title {
line-height: 2.5ex;
height: 5ex;
overflow: hidden;
text-overflow: ellipsis;
}
Hi thanks again that worked perfectly.
And also I am sorry to bug you so much. But I also want to make this image sticky in my sidebar. Can you also let me know what should I do to do that?
Can you open a new topic for the new question?
Thanks :)