Archived topic
Add read more link to custom excerpts on Custom Post Type
13 replies · Started by Alfonso on June 10, 2021
Hi there, i need to add Read More link to custom Excerpts on Custom Post Type,
im tried wit this code:
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
if ( has_excerpt() ) {
$output = sprintf( '%1$s %3$s',
$excerpt,
get_permalink(),
__( 'Read more', 'generatepress' )
);
}
return $output;
}
But is not working
Hi Alfonso,
Your code is missing the HTML tags.
Can you try the code provided here instead? https://docs.generatepress.com/article/activating-read-custom-excerpt/#read-more-button
Let us know how it goes.
Hi Elvin,
I've been solved.
So i have a new question, how i can change breakpoints?
I need tablet mode change from 768px to 1200px, is not possible?
I need tablet mode change from 768px to 1200px, is not possible?
Is this for a specific element or for the whole page?
If it's for the whole page, it's going to be tricky to do because some CSS are hardcoded on the stylesheets.
You can try Tom's filter here - https://generatepress.com/forums/topic/setting-custom-responsive-css-media-max-width-ranges/#post-1416756
But this one doesn't affect the ones that are already hardcoded.
Hi Elvin,
I've tried Tom's filter and is not working :(
You can check at:
https://aelmhu2.111pixels.com/
From 1025px to 1280px i have problems with header, font size etc...
As mentioned previously, it won't be fully effective because some CSS are hardcoded to the following breakpoints:
@media(min-width:1025px) - bigger desktops
@media(min-width:769px) and (max-width: 1024px) - tablet and smaller desktop
@media(max-width:768px) - mobile viewport
You can find these @media rules through all the .css files of the theme.
To change these, I'm afraid you'll have to manually override them w/ custom CSS.
But is not possible to make mobile header until to 1200px for example?
Hi there,
if its just the Mobile Header you want to change the breakpoint - go to Customizer > Layout > Primary Navigation and increase the Mobile Menu Breakpoint to 1200
Thank you David.
The other contents do you recommend that i must apply new custom css styles to font size etc...?
I have another question, im trying to make a full with image on my archive pages but the image having only the container with.
However, on a normal page, if I get the image to be full witdh.
Single page:
https://aelmhu2.111pixels.com/articulos-de-revision/
Archive page (generate_inside_site_container):
https://aelmhu2.111pixels.com/noticias/
I've added this content on "Before main content" Hook and i have also tried "inside_site_container" Hook but both with the same result.
https://aelmhu2.111pixels.com/entrevistas/ (before_main_content)
Hi Alfonso,
If you want the image to be full width, try after_header hook instead.
The other contents do you recommend that I must apply new custom css styles to font size etc…?
I'm afraid so.
Hi there,
The <p> is from an empty paragraph within the Block Element.
It's under the container block. You can use the list view to find it - https://share.getcloudapp.com/DOuqxLAZ
Thank you very much Elvin!
No problem. Glad to be of any help. :D