Hi,
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\elementor
I 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