• Resolved florianwilhelm

    (@florianwilhelm)


    Hi,

    I want to use the Blog Section of my homepage to display clients testimonies.
    I know there is a Testimony section in Hestia, but I prefer to use a post-based blog section that will allow me to update my content smoothly.

    I tried to find my way around to limit posts displayed in the Blog Section to my category ‘testimony’ according to what is said here: https://premium.wpmudev.org/blog/one-category-wordpress-homepage/ but it did not work (at the moment, there is a post from the category ‘autre-categorie’ as well).

    I wanted to add a modified hestia-blog-section.php to my child theme, as mentionned here: https://www.ads-software.com/support/topic/categories-in-the-blog-section/ but I cannot manage to find this file in my Hestia folder, and as this solution was proposed 9 months ago, maybe it’s obsolete by now.

    Could you let me know what is the correct way to achieve a single-category blog-section on the homepage? That would rock my world.
    Thanks and best regards
    Florian

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    You can use Elementor for the frontpage, combined with the Orbit Fox plugin, which has a Post type grid widget for Elementor, and that allows you to select a custom post type, and the category you want to use.
    https://prnt.sc/l26qil

    Regards,
    Rodica

    Thread Starter florianwilhelm

    (@florianwilhelm)

    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
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change category of posts displayed in Blog Section’ is closed to new replies.