Welcome! To use this support forum, please Login or Join Today!

   

Resizing Images

{name}
RankRank

Total Posts: 37

Joined 2012-03-19

PM

 

I’m having a bit of a nightmare,

I’ve created a custom post type and I’m using <?php do_action(‘skeleton_featured_image’); ?> to pull the featured image into a <class=“section”> but it’s adding <img width=“150” height=“100”> at the start of each image.

I used the page builder to build the homepage and the image size is perfect and responsive. But I just can’t seem to override the size limitations on my CPT.

Any ideas what I can do?

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

If you add this to your child theme functions.php, you can specifically set the width and CSS class on the featured images.

function my_custom_thumbnail() {
    if (is_home()) {
        $atts = array(
            'size' => array(640,480),
            'class' => 'alignleft featured'
        );
    }
    return $atts;
}
add_filter('skeleton_thumbnail','my_custom_thumbnail',11);


The above function conditionally sets the image to 640x480 with a class of .alignleft.featured on the blog home (is_home()) only. In your case, you may want to use something such as is_post_type(‘post_type’)

{name}
RankRank

Total Posts: 37

Joined 2012-03-19

PM

 

Extremely Far from a PHP expert, my Child Functions.php looks like this:

<?php

/**
* Lightfast Child Theme
*
* @category   WordPress
* @package   Lightfast
* @author   Simple Themes
* @copyright 2007-2014 Simple Themes LLC
* @license   http://www.gnu.org/licenses/gpl.html  GPL 3.0
* @link     http://www.simplethemes.com/wordpress-themes/theme/lightfast
*
*
* This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt.  If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to .(JavaScript must be enabled to view this email address) so we can mail you a copy immediately.
*
*/

/*—————————————————————————————————————————-*/
// CPT Image Resizing
/*—————————————————————————————————————————-*/

function my_custom_thumbnail() {
  if (is_post_type(‘category’)()) {
      $atts = array(
        ‘size’ => array(640,480),
        ‘class’ => ‘alignleft featured’
      );
  }
  return $atts;
}
add_filter(‘skeleton_thumbnail’,‘my_custom_thumbnail’,11);

?>

And it keep giving me a syntax error on line 33 which appears to be ‘return $atts;’ any ideas what rookie mistake I’m making?