• Resolved llprice

    (@llprice)


    Please help.
    I want to add a custom image “catalog-size,” for all users, as an alternate thumb-size post insert.
    I want this custom size to work like all the others in the Fancybox jQuery expander.
    The following code is already in Functions.php.

    add_theme_support( 'post-thumbnails' );

    This is my custom size request —

    add_image_size( 'catalog-size', 460, 230, true );

    I’ve read some help pages, but I’m still not sure where to insert add_image_size() — in Media.php, Functions.php, or in the loop?

    Where would I add margin or padding if needed?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    It goes on functions.php, but if you edit your theme’s file, your change will be lost when the theme is updated. To protect it, create a child theme and put your code on the child theme’s functions.php.

    To adjust margins and padding, add the needed CSS to the child theme’s style.css. Any styling for img or .align* from the parent theme should be applied to this image size as well. There should also be a size-catalog-size class that can be used to style only this image size. Check the HTML source of a post with this size image to identify other possible CSS selectors.

    Thread Starter llprice

    (@llprice)

    Hello bcworks,

    Thank you. I added the snippets to functions.php, and after some trial and error — it works!
    Thanks for confirming that the name I gave the custom size might be a class selector. I may need that.

    I agree about the child theme. I’m working on an organization site. Someone else set it up and picked the theme. They even had some custom work done — in the theme itself. For some time, I have been recommending the use of a child-theme, but no one else agrees it’s important. I started a child theme anyway, but I haven’t activated it. I save copies of MY changes on an external-dive and in the inactive child, anticipating that someday, it will be needed.

    Again, Thanks so much.

    Moderator bcworkz

    (@bcworkz)

    You’re welcome!

    If they never update the theme then it’s easy to think a child theme is not important. But if the theme author happens to find a security flaw and patches it, the flaw will remain in the old customized theme and eventually some hacker will discover the hole.

    If no one thinks that could be an issue, at least keep regular backups so when a hack does occur it’s easy to recover.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘add_image_size question’ is closed to new replies.