florianwilhelm
Forum Replies Created
-
Forum: Plugins
In reply to: [Related Posts for WordPress] Display related posts at a different placeGreat, thank you very much for your support!
Forum: Plugins
In reply to: [Related Posts for WordPress] Display related posts at a different placeI actually found the shortcode to put the related posts in my template using rp4wp_children();
But I still have the related posts at the end of my posts: https://ibb.co/68VZqG2Could you help me remove it?
Thank you for the support
FlorianForum: Plugins
In reply to: [Related Posts for WordPress] Display related posts at a different placeBy the way, I was using another Related Posts plug-in before, which appears in my code. I stopped using it as it causes conflicts with the fact I have multiple languages.
I would like to basically put your plug-in at this place in my template, if that is possible.
Forum: Fixing WordPress
In reply to: Latest Posts blockAs it goes to wp-include, i don’t think you can include it to a theme or whatever.
My take on this at the moment is just to keep it in mind each time I have a wp update, which of course is not the best :/Forum: Fixing WordPress
In reply to: Latest Posts blockHi,
I solved my problem using the following piece of code:
foreach ( $recent_posts as $post ) { $post_id = $post['ID']; $title = get_the_title( $post_id ); if ( ! $title ) { $title = __( '(Untitled)' ); } $post_url = get_permalink( $post_id ); $text = get_post( $post_id ); $text = $text->post_content; $text = wp_trim_words( $text, 25, '... <a href="'.$post_url.'">read more</a>' ); $excerpt = $text; $list_items_markup .= sprintf( '<li> <a href="%2$s">%1$s%3$s</a><p>%4$s</p>', get_the_post_thumbnail( $post_id ), esc_url( get_permalink( $post_id ) ), esc_html( $title ), $excerpt );
It shows the target post 25 first words and I put a link on the read more to access said post. It might not be the best way to do this but it works, which makes it the best way for me ??
Hope it might help if someone has the same issue.
Have a nice day,
Florian- This reply was modified 6 years, 2 months ago by florianwilhelm. Reason: solved
Forum: Fixing WordPress
In reply to: Latest Posts blockBy the way, I tried adding manualy an excerpt to my post with <!–more–> just to be sure it was not a conflict caused by the lack of excerpt in my post, but it doesn’t change anything to my Latest Posts block.
Forum: Fixing WordPress
In reply to: Latest Posts blockHi,
Removing get_ from get_the_excerpt doesn’t change anything for me, it still displays the current page excerpt instead of the $post_id one.
I think it comes from the fact it doesn’t get $post_id as a valid argument, and the default value get_the_excerpt() and the_excerpt() are the global post (the current page/post).
My knowledges in PhP are not so good, which makes it hard for me to identify clearly the problem.Forum: Fixing WordPress
In reply to: Latest Posts blockHi,
I found the file to edit:
In wordpress folder, wp-includes/blocks/latest-posts.phpI had success putting the post thumbnail but when I try to have the post excerpt, it shows the current page excerpt instead of the post’s.
I edited only a small part of the code (line 39):
$list_items_markup .= sprintf( '<li> <a href="%2$s">%1$s%3$s</a><p>%4$s</p>', get_the_post_thumbnail( $post_id ), esc_url( get_permalink( $post_id ) ), esc_html( $title ), get_the_excerpt( $post_id ) );
Here is the complete code (edited by me):
<?php /** * Server-side rendering of the <code>core/latest-posts</code> block. * * @package WordPress */ /** * Renders the <code>core/latest-posts</code> block on server. * * @param array $attributes The block attributes. * * @return string Returns the post content with latest posts added. */ function render_block_core_latest_posts( $attributes ) { $args = array( 'numberposts' => $attributes['postsToShow'], 'post_status' => 'publish', 'order' => $attributes['order'], 'orderby' => $attributes['orderBy'], ); if ( isset( $attributes['categories'] ) ) { $args['category'] = $attributes['categories']; } $recent_posts = wp_get_recent_posts( $args ); $list_items_markup = ''; foreach ( $recent_posts as $post ) { $post_id = $post['ID']; $title = get_the_title( $post_id ); if ( ! $title ) { $title = __( '(Untitled)' ); } $list_items_markup .= sprintf( '<li> <a href="%2$s">%1$s%3$s</a><p>%4$s</p>', get_the_post_thumbnail( $post_id ), esc_url( get_permalink( $post_id ) ), esc_html( $title ), get_the_excerpt( $post_id ) ); if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) { $list_items_markup .= sprintf( '<time datetime="%1$s" class="wp-block-latest-posts__post-date">%2$s</time>', esc_attr( get_the_date( 'c', $post_id ) ), esc_html( get_the_date( '', $post_id ) ) ); } $list_items_markup .= "</li>\n"; } $class = 'wp-block-latest-posts'; if ( isset( $attributes['align'] ) ) { $class .= ' align' . $attributes['align']; } if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) { $class .= ' is-grid'; } if ( isset( $attributes['columns'] ) && 'grid' === $attributes['postLayout'] ) { $class .= ' columns-' . $attributes['columns']; } if ( isset( $attributes['displayPostDate'] ) && $attributes['displayPostDate'] ) { $class .= ' has-dates'; } if ( isset( $attributes['className'] ) ) { $class .= ' ' . $attributes['className']; } $block_content = sprintf( '<ul class="%1$s">%2$s</ul>', esc_attr( $class ), $list_items_markup ); return $block_content; } /** * Registers the <code>core/latest-posts</code> block on server. */ function register_block_core_latest_posts() { register_block_type( 'core/latest-posts', array( 'attributes' => array( 'categories' => array( 'type' => 'string', ), 'className' => array( 'type' => 'string', ), 'postsToShow' => array( 'type' => 'number', 'default' => 5, ), 'displayPostDate' => array( 'type' => 'boolean', 'default' => false, ), 'postLayout' => array( 'type' => 'string', 'default' => 'list', ), 'columns' => array( 'type' => 'number', 'default' => 3, ), 'align' => array( 'type' => 'string', ), 'order' => array( 'type' => 'string', 'default' => 'desc', ), 'orderBy' => array( 'type' => 'string', 'default' => 'date', ), ), 'render_callback' => 'render_block_core_latest_posts', ) ); } add_action( 'init', 'register_block_core_latest_posts' );
As I said, thumbnail is working well, so I don’t really get why the excerpt doesn’t.
Much appreciation to any help,
Florian- This reply was modified 6 years, 2 months ago by florianwilhelm.
Forum: Fixing WordPress
In reply to: Post Attributes block missesActually I solved it at the moment.
It seems that Hestia-pro template files do not define if they are available for post or not, so they are not considered for posts, which deactivated Post Attributes while editing.
It looks like putting
/* Template Post Type: post*/
fixed the issue.Sorry for the bother.
Forum: Themes and Templates
In reply to: [Hestia] Change category of posts displayed in Blog SectionHi,
overall this is working: [ redundant link removed ]
I have my Testimony widget that can display posts from the ‘testimony’ category.
I did not use Elementor to build the page, as I had already worked on it with SiteOrigin, and if I can I’d like to avoid redoing it. I added the “post grid” widget through SiteOrigin builder, which makes it work despite maybe having less customization options through the interface.I just need one last edit on it and it’ll work fine for me, and maybe you can help me with it:
I currently have a link to my post only available on the h3 title. I would like to have one on the picture as well, to improve a little my users experience. I tried to edit the posts-grid.php file, located in \themeisle-companion\vendor\codeinwp\elementor-extra-widgets\widgets\elementorI think I need to edit the following, but I might be doing it wrong as it does nothing for me:
protected function renderImage() { $settings = $this->get_settings(); // Only in editor. if ( $settings['grid_image_hide'] !== 'yes' ) { // Check if post type has featured image. if ( has_post_thumbnail() ) { if ( $settings['grid_image_link'] == 'yes' ) { ?> <div class="obfx-grid-col-image"> <a*>" title="<?php the_title(); ?>"> <?php the_post_thumbnail( 'full', array( 'class' => 'img-responsive', 'alt' => get_the_title( get_post_thumbnail_id() ), ) ); ?> </a> </div> <?php } else { ?> <div class="obfx-grid-col-image"> <?php the_post_thumbnail( 'full', array( 'class' => 'img-responsive', 'alt' => get_the_title( get_post_thumbnail_id() ), ) ); ?> </div> <?php } } } }</blockquote> I changed it to have the following: <blockquote> protected function renderImage() { $settings = $this->get_settings(); // Only in editor. if ( $settings['grid_image_hide'] !== 'yes' ) { // Check if post type has featured image. if ( has_post_thumbnail() ) { if ( $settings['grid_image_link'] == 'yes' ) { ?> <div class="obfx-grid-col-image"> <a*>" title="<?php the_title(); ?>"> <?php the_post_thumbnail( 'full', array( 'class' => 'img-responsive', 'alt' => get_the_title( get_post_thumbnail_id() ), ) ); ?> </a> </div> <?php } else { ?> <div class="obfx-grid-col-image"> <a*>" title="<?php the_title(); ?>"> <?php the_post_thumbnail( 'full', array( 'class' => 'img-responsive', 'alt' => get_the_title( get_post_thumbnail_id() ), ) ); ?> </a> </div> <?php } } } }
(I added * in my <a*> so they’ll display in the forum)
Basically, I want to force it to have a link on the picture in any case, but it’s not doing the trick. Do you have any indication on how I could fix it?Thanks
Florian- This reply was modified 6 years, 5 months ago by florianwilhelm.
- This reply was modified 6 years, 5 months ago by Jan Dembowski. Reason: Fixed formatting, don't use block quote for code
Forum: Themes and Templates
In reply to: [Hestia] Posts display within blog page.Just so people know, in case you have the same problem as I did, I resolved it by changing the post width and thumbnail dimensions, following this documentation:
https://docs.themeisle.com/article/853-how-to-make-hestia-blog-images-full-width
https://docs.themeisle.com/article/852-how-to-change-blog-image-size-in-hestiaCheers
Forum: Themes and Templates
In reply to: [Hestia] HESTIA_DEBUG ErrorHi @rodicaelena!
I have downloaded again the Hestia folder and put back the clean functions.php file, and it’s working like a charm, thanks!
I am not so used to work with wordpress so I changed Hestia’s file directly previous my child-theme creation, and did not expect updates to mess it up. Guess it’s the way to learn ??Have a nice day & weekend
FlorianForum: Themes and Templates
In reply to: [Hestia] Posts display within blog page.Basically, what I want to do is change the display so it goes from the current:
PICTURE TEXT
TEXT PICTURE
PICTURE TEXT
TEXT PICTUREeach post goes in a line-block composed of its featured picture and text (title, excerpt, …). What I want is this:
PICTURE
TEXT
PICTURE
TEXTEach post is displayed with the featured picture full-width and texts below.
Let me know if you guys need more info!Florian
Forum: Themes and Templates
In reply to: [Hestia] HESTIA_DEBUG ErrorHi Rodica,
I think I used this method though I can’t guarantee it.
Here you can find my child-theme function.php file (in txt for the upload):
function.php file https://de.scribd.com/document/389594761/Function-phpI also edited Hestia’s functions.php file, so I’ll join it as well:
https://de.scribd.com/document/389594901/Functions-phpThere is no mention of hestia_debug in both those files though.
Let me know if you need more information!Florian
Forum: Themes and Templates
In reply to: [Hestia] Posts display within blog page.Hi,
Yes I do: https://imgur.com/a/riyW2Ao
Should I remove it? Last time i tried it changed the whole page design quite a lot, which would imply a lot of css adjustments.