• Resolved incontrol69

    (@incontrol69)


    Hi !

    there is a template page on my theme I use to showcase my pics with a title and some text. I like it very much ??
    I found out there is a php file called content-portfolio.php that displays the image, the title and the text of all the articles that belongs to the portfolio kind.

    The image displayed is the thumbnail. And I would like to have the full image, not cropped here. I know it is the next step for me in WP, to understand php better, so rather than calling the thumbnail, how do I call the full size image in here ?

    Thank you

    
    <?php if ( has_post_thumbnail() ): 
                                                    
                			$personal_portfolio_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'personal-portfolio' ); ?>    
                                                    
         					<img src="<?php echo esc_url( $personal_portfolio_src[0] ); ?>" class="aligncenter">     
                                                
                        <?php endif; ?>
    

    Reference page of the theme I use : https://modernthemes.net/wordpress-themes/personal/

    • This topic was modified 7 years, 4 months ago by Jose Castaneda.
    • This topic was modified 7 years, 4 months ago by Jose Castaneda.
    • This topic was modified 7 years, 4 months ago by Jose Castaneda. Reason: fixed codeblock
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hi there @incontrol69

    One way could be by using a child theme and using the the_post_thumbnail() inside of that.

    What you would do is duplicate the content-portfolio.php file to the child theme and instead of the code block you shared you would use:

    
    <?php if ( has_post_thumbnail() ): 
      the_post_thumbnail( 'full' ); // this is what will get the full resolution of the "featured image"  
    endif; ?>
    

    Let us know if this helps!

    Thread Starter incontrol69

    (@incontrol69)

    Hello Jose,

    this actually works ??

    The content-portfolio.php file was not at the root of my parent theme folder. It was in a subfolder called “template-parts”.

    I tried to add content-portfolio.php at the root of my chid theme folder, but it didn’t work. I had to re-create a “template-parts” subfolder in which I added the newly edited content-portfolio.php

    Thanks a million for your help.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Awesome!

    Glad to see this worked. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘getting full image rather than thumbail’ is closed to new replies.