Digital experiences for all disciplines
New Landing › How can we help? › Atelier › Related Projects Name and Dimensions
New Landing › How can we help? › Atelier › Related Projects Name and Dimensions
- This topic has 15 replies, 4 voices, and was last updated 8 years by Kyle – SUPPORT.
-
Posted in: Atelier
-
October 22, 2015 at 10:12 pm #222663
I am using the Portfolio with images that are portrait (1:1.4 ratio).
1.) How do I change the dimensions of the “Related Projects” shown at the bottom of a portfolio item page? Right now it is cropping images and cutting them off. I want it to show images at 225 x 325 pixels.
2.) How do I change the name of the section from “Related Projects” to “Related Celebrities” or similar?
3.) How do I change the Portfolio home page widget link that says “View All Projects” to something else?
Thanks!
Attachments:
You must be logged in to view attached files.October 23, 2015 at 11:47 am #222802Hi
Add this to your child theme’s functions.php file:
/* PORTFOLIO RELATED PROJECTS ================================================== */ if ( ! function_exists( 'sf_portfolio_related_projects' ) ) { function sf_portfolio_related_projects() { global $post, $sf_options; $fullwidth = $sf_options['related_projects_fullwidth']; $item_count = $sf_options['related_projects_columns']; $related = sf_portfolio_related_posts( $post->ID, $item_count ); $item_class = "col-sm-4"; $wrap_class = $heading_class = ""; if ( $fullwidth ) { $heading_class = "container"; } else { $wrap_class = "container"; } $hover_style = "default"; // Thumb Type if ( function_exists( 'sf_get_thumb_type' ) && sf_theme_opts_name() == "sf_atelier_options" ) { $wrap_class .= ' ' . sf_get_thumb_type(); } else if ( function_exists( 'sf_get_thumb_type' ) && $hover_style == "default" ) { $wrap_class .= ' ' . sf_get_thumb_type(); } else { $wrap_class .= ' thumbnail-' . $hover_style; } if ( $item_count == "4" ) { $item_class = "col-sm-3"; } if ( $related->have_posts() ) { ?> <section class="related-projects <?php echo esc_attr($wrap_class); ?> clearfix"> <h2 class="<?php echo esc_attr($heading_class); ?>"><?php echo apply_filters('sf_related_projects_heading', __( "Related Projects", "swiftframework" )); ?></h2> <div class="clearfix"> <?php while ( $related->have_posts() ): $related->the_post(); ?> <?php $item_title = get_the_title(); $item_subtitle = sf_get_post_meta( $post->ID, 'sf_portfolio_subtitle', true ); $thumb_image = $port_hover_style = $port_hover_text_style = ""; $thumb_image = sf_get_post_meta( $post->ID, 'sf_thumbnail_image', true ); if ( ! $thumb_image ) { $thumb_image = get_post_thumbnail_id(); } $thumb_img_url = wp_get_attachment_url( $thumb_image, 'full' ); if ( $thumb_img_url == "" ) { $thumb_img_url = "default"; } $image = sf_aq_resize( $thumb_img_url, 500, 375, true, false ); $image_alt = esc_attr( sf_get_post_meta( $thumb_image, '_wp_attachment_image_alt', true ) ); $port_hover_bg_color = sf_get_post_meta( $post->ID, 'sf_port_hover_bg_color', true ); $port_hover_text_color = sf_get_post_meta( $post->ID, 'sf_port_hover_text_color', true ); if ( $port_hover_bg_color != "" ) { $overlay_opacity = $sf_options['overlay_opacity']; if ( $overlay_opacity == 100 ) { $overlay_opacity = '1'; } else { $overlay_opacity = '0.' . $overlay_opacity; } $port_hover_bg_rgb = sf_hex2rgb( $port_hover_bg_color ); $port_hover_style = 'style="background-color:rgba(' . $port_hover_bg_rgb['red'] . ',' . $port_hover_bg_rgb['green'] . ',' . $port_hover_bg_rgb['blue'] . ',' . $overlay_opacity . ')"'; } if ( $port_hover_text_color != "" ) { $port_hover_text_style = 'style="color: ' . $port_hover_text_color . ';"'; } ?> <article class="<?php echo esc_attr($item_class); ?>"> <figure class="animated-overlay overlay-style"> <img src="<?php echo esc_url($image[0]); ?>" width="<?php echo esc_attr($image[1]); ?>" height="<?php echo esc_attr($image[2]); ?>" alt="<?php echo esc_attr($image_alt); ?>"/> <a href="<?php the_permalink(); ?>"></a> <figcaption <?php echo esc_attr($port_hover_style); ?>> <div class="thumb-info"> <h4 <?php echo esc_attr($port_hover_text_style); ?>><?php echo esc_attr($item_title); ?></h4> <div class="name-divide"></div> <h5 <?php echo esc_attr($port_hover_text_style); ?>><?php echo esc_attr($item_subtitle); ?></h5> </div> </figcaption> </figure> </article> <?php endwhile; ?> </div> </section> <?php } }
you’ll need to edit the h2 tag:
<h2 class="<?php echo esc_attr($heading_class); ?>"><?php echo apply_filters('sf_related_projects_heading', __( "Related Projects", "swiftframework" )); ?></h2>
to change Related Projects to something else
To change the image sizes you will need to edit this line:
$image = sf_aq_resize( $thumb_img_url, 500, 375, true, false );
– Kyle
November 4, 2015 at 8:04 am #225633I tried to make the update to the child theme and received a syntax error that I had to reverse in order to make the site operational.
Leaving that question alone for one second, can you please let me know how to change the “View All Projects” and “View All Products” and “View All Articles” text on the SPB widgets for Portfolio, Products and Blog? For example, I want the “View All Projects” text in the attached screenshot to say “View All” only. Thanks!
Attachments:
You must be logged in to view attached files.November 4, 2015 at 9:24 am #225654The easiest way to change those would be to use the Codestyle Localization plugin and edit the strings
– Kyle
November 4, 2015 at 9:42 am #225665Do you mind providing a link to this plugin? In my research it looks like this plugin is no longer live or supported. Please advise.
November 4, 2015 at 9:45 am #225666November 8, 2015 at 12:40 am #226867I am confused by the purpose of this plugin as I do not need to translate anything. Can you please provide further instructions or advice? I need each of the widgets on the home page to have a link that reads “View All” and this is something my client really wants before I can close out the project. Thanks!
November 9, 2015 at 9:48 am #226931Using translation plugins makes it easy to change the words the theme uses, you don’t have to translate the theme to another language you just change a few strings.
The only other way would be to edit the theme files but you would need to edit each file
– Kyle
November 15, 2015 at 1:32 am #228792I have the plugin installed. Are you able to login to my admin and make the changes? It’s one of the last changes needed for me to close out the project.
The other thing is the the same question as my original, can you add the code to my functions.php in order to fix the dimensions on the Related Celebrities on pages like this: http://grazielagems.com/portfolio/taylor-swift/
Those pages do not look good right now. You have full permission to login to the site and make the changes. Thanks!
November 17, 2015 at 6:06 am #229222Are you able to provide services to complete my original 3 questions? These are the last items I need closed out in order to bill the client. You have my permission to login and make the changes if at all possible. Thanks!
1.) How do I change the dimensions of the “Related Projects” shown at the bottom of a portfolio item page? Right now it is cropping images and cutting them off. I want it to show images at 225 x 325 pixels.
2.) How do I change the name of the section from “Related Projects” to “Related Celebrities” or similar?
3.) How do I change the Portfolio home page widget link that says “View All Projects” to something else?
November 18, 2015 at 6:04 am #229534When I try to update functions.php with the code you provide, I get this error message:
Parse error: syntax error, unexpected end of file in /home/content/p3pnexwpnas01_data03/11/2936911/html/wp-content/themes/atelier/functions.php on line 726
November 19, 2015 at 11:59 am #229880Hi,
Do not edit your theme
functions.php
file, you will need to put the amended code into the supplied child theme, inside the child theme folder there is afunctions.php
that you will need to add the changes to.Please use this plugin to find and replace “https://wordpress.org/plugins/real-time-find-and-replace/” https://wordpress.org/plugins/real-time-find-and-replace/
Thanks,
David.December 29, 2015 at 9:02 pm #237646This reply has been marked as private.January 4, 2016 at 11:14 am #238064That will likely mean there is a missing PHP tag in the
functions.php
file.Please add your FTP details and we will take a look for you.
Thanks.
January 6, 2016 at 8:18 pm #238689No worries David, I fixed it myself via FTP. Though I’m still having some issue making my changes in the functions.php file take effect.
I’ve created a new thread regarding the matter. (http://www.swiftideas.com/forums/topic/changing-related-products-and-title-in-functions-php/)
Thanks!
-
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.