-
-
Hello,
a few weeks ago I created portfolio items with Container Slider above the content.
Pictures were showing 960 x 640 px.
If I create a portfolio item now with the same style the pictures show with 960 x 390 px.I dont know why that is. Did change something in the template with an update or what can I do?
As the site is not available for the public yet, I could give you login if you like to take a look.
Thanks for Feedback
Bernd -
Hello,
Please go to file functions.php in Specular theme folder and find these lines:
function codeless_images_sizes(){ add_image_size( 'port3', 600, 600, true ); add_image_size( 'port3_grayscale', 627, 470, true ); add_image_size( 'port2', 460, 275, true ); add_image_size( 'port2_grayscale', 940, 470, true ); add_image_size( 'port4', 600, 600, true );
Here are all sizes of all portfolio/blog types. Edit the dimensions of image at the specific portfolio type you are using, or add a new one if it doesn’t exists. After this, import again the images and run a plugin that recreates thumbnails.
Let us know if you need help.Best regards!
-
This reply was modified 10 years ago by
Mirela.
-
This reply was modified 10 years ago by
-
Hello Mihaila,
as I use the child-theme of Specular, could I embed the altered code for this in functions.php of the child theme?
Like this:
<?php
Function child_enqueue_scripts() {
wp_register_style( ‘childtheme_style’, get_stylesheet_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘childtheme_style’ );
}
add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_scripts’);
function codeless_images_sizes(){
add_image_size( ‘port3’, 600, 600, true );
add_image_size( ‘port3_grayscale’, 627, 470, true );
add_image_size( ‘port2’, 460, 275, true );
add_image_size( ‘port2_grayscale’, 940, 470, true );
add_image_size( ‘port4’, 600, 600, true );
add_image_size( ‘blog’, 960, 640, true );
add_image_size( ‘alternate_blog’, 440, 195, true );
add_image_size( ‘alternate_blog_side’, 355, 235, true );
add_image_size( ‘blog_grid’, 350, 350, true );
add_image_size( ‘staff’, 400, 270, true );
add_image_size( ‘staff_full’, 500, 340, true );
}
?>
So I would not have to make these changes everytime I update the theme?
Thank you for Help!
Bernd -
Hello,
Sorry for the late reply.
Yes, that should be good.Best regards!
-
If I add the code like that:
<?php
Function child_enqueue_scripts() {
wp_register_style( ‘childtheme_style’, get_stylesheet_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘childtheme_style’ );
}
add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_scripts’);
function codeless_images_sizes(){
add_image_size( ‘port3’, 600, 600, true );
add_image_size( ‘port3_grayscale’, 627, 470, true );
add_image_size( ‘port2’, 460, 275, true );
add_image_size( ‘port2_grayscale’, 940, 470, true );
add_image_size( ‘port4’, 600, 600, true );
add_image_size( ‘blog’, 960, 640, true );
add_image_size( ‘alternate_blog’, 440, 195, true );
add_image_size( ‘alternate_blog_side’, 355, 235, true );
add_image_size( ‘blog_grid’, 350, 350, true );
add_image_size( ‘staff’, 400, 270, true );
add_image_size( ‘staff_full’, 500, 340, true );
}
?>
I get this failure:
<b style=”color: #000000; font-family: Times; line-height: normal;”>Fatal error</b><span style=”color: #000000; font-family: Times; font-size: medium; line-height: normal;”>: Cannot redeclare codeless_images_sizes() (previously declared in /www/htdocs/w00fc17a/destino-creative.de/wp-content/themes/specular-child/functions.php:16) in </span><b style=”color: #000000; font-family: Times; line-height: normal;”>/www/htdocs/w00fc17a/destino-creative.de/wp-content/themes/specular/functions.php</b><span style=”color: #000000; font-family: Times; font-size: medium; line-height: normal;”> on line </span><b style=”color: #000000; font-family: Times; line-height: normal;”>162</b>
What to do?
Thank you
Bernd -
Hello,
I suggest you to keep the changes at parent theme and update only the changes file on each theme update.
The image sizes can’t be declared at child theme.
Or you can specify the image size directly at portfolio or blog file.
Ex. Replace this:<img src="<?php echo esc_url(codeless_image_by_id(get_post_thumbnail_id(), 'port4', 'url')) ?>" alt="">
with:
<img src="<?php echo esc_url(codeless_image_by_id(get_post_thumbnail_id(), array(250, 250), 'url')) ?>" alt="">
Best regards!
-
You must be logged in to reply to this topic.