Home › Forums › Free Themes › Photo Perfect › Main page photo links to blog post instead of enlarging photo!
Tagged: link
- This topic has 4 replies, 2 voices, and was last updated 8 years, 1 month ago by champagne07.
-
AuthorPosts
-
October 31, 2016 at 4:42 pm #22246champagne07Participant
Hi,
I’ve asked this question before but I’m having issues with it again. I updated my theme and I can’t figure out how to change it back. Could you do me a favour and copy and paste the exact text that would be replaced in content masonary?
Thanks!
wanderlustkyla.comNovember 2, 2016 at 1:46 am #22311wensolutionsKeymasterImage thumbnails comes with two icons overlay for image enlarge ( eye icon) and for post link (anchor icon). Hope this is what you are looking for.
November 2, 2016 at 2:36 am #22315champagne07ParticipantI want the code to put in that changes the image on the main page from enlarging and instead just goes into the blog post. When people click on the image on the main page I want it to bring them into the post not enlarge the image. I need the coding to write under the masonary template in the editor. I had the code before but when I updated it reverted back. Thanks.
November 2, 2016 at 3:24 am #22316wensolutionsKeymasterHello,
We are sorry that your changes were reverted back after the update, but if you make changes on the parent theme it will always be reverted on the update.
We will provide you a method with which you can keep your changes safe.
First of all you will have to create a child theme for theme theme you are using currently. You can make the child theme manually or use a certain plugin like https://wordpress.org/plugins/wp-child-theme-generator/ to create a child theme.
Now after you have created the child theme, you will have to make a template-parts folder inside the child theme.
After you have created the template-parts folder, create a file named content-masonry.php inside the template-parts folder.
Now open the content-masonry.php file and inside it paste the below given code
<?php /** * Template part for displaying posts in masonry. * * @link https://codex.wordpress.org/Template_Hierarchy * * @package Photo_Perfect */ ?> <article id="post-<?php the_ID(); ?>" <?php post_class( 'masonry-entry' ); ?>> <?php $featured_image_full_url = ''; if ( has_post_thumbnail() ) { $featured_image_full_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); } ?> <div class="masonry-thumbnail post-item"> <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink();?>" class="post-thumb"> <?php the_post_thumbnail( 'large' ); ?> </a> <?php else : ?> <?php $no_image_url = ''; $random_number = rand( 1, 2 ); $no_image_url = get_template_directory_uri() . '/images/no-image-'. esc_attr( $random_number ). '.png'; ?> <a href="<?php the_permalink(); ?>" class="post-thumb"> <img src="<?php echo esc_url( $no_image_url );?>" alt="<?php the_title_attribute(); ?>" /> </a> <?php endif ?> <div class="post-content"> <?php if ( ! empty( $featured_image_full_url ) ) : ?> <a href="<?php echo esc_url( $featured_image_full_url ); ?>" class="popup-link"><i class="fa fa-eye"></i></a> <?php endif ?> <a href="<?php the_permalink(); ?>"><i class="fa fa-link"></i></a> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> </div> </div><!-- .masonry-thumbnail --> </article><!-- #post-## -->
Now you have a child theme with the changes you want.
Similarly, you can also override other templates and functions via child theme.Hope it helps.
Best regards.November 2, 2016 at 7:40 pm #22392champagne07ParticipantIt worked! Thanks so much!
-
AuthorPosts
- You must be logged in to reply to this topic.