Need help using this plugin on posts featured images
-
i want to activate the zoom function on featured images on the posts only. How can i do this? I am using tyche theme.
-
This topic was modified 8 years, 6 months ago by
csandreas1.
The page I need help with: [log in to see the link]
-
This topic was modified 8 years, 6 months ago by
-
Make a backup of your template’s single post template then edit it to replace the the code that calls the featured image, using instead the code listed in the plugin’s faq to call the zoomable image:
if ( function_exists('cc_zoom_featured_image') ) { cc_zoom_featured_image(); }What is the default wordpress code that calls featured image?
-
This reply was modified 8 years, 6 months ago by
csandreas1.
the_post_thumbnail();I have searched for
the_post_thumbnail();with AstroGep but it only found that in wordpress default themes and not tyche theme. By investigating tyche theme i have found inside class-tyche.php file the following that has to do with post.add_image_size( 'tyche-blog-post-image', '730', '435', true );and
add_theme_support( 'post-thumbnails' );-
This reply was modified 8 years, 6 months ago by
csandreas1.
-
This reply was modified 8 years, 6 months ago by
csandreas1.
-
This reply was modified 8 years, 6 months ago by
csandreas1.
Tyche is a free theme from WordPress.org so I have been able to look at the theme’s files. The
the_post_thumbnailfunction is called intemplate-parts/content.php. It not advised to edit the theme’s files directly, but to use a child theme to apply the modifications.the code is here, i am trying to replace parts with the code you posted in your first post but the image dissapear i am replacing this
<?php if ( has_post_thumbnail() ) { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; the_post_thumbnail( 'tyche-blog-post-image' ); echo ! is_single() ? '</a>' : ''; } ?>with this
:<?php if ( has_post_thumbnail() ) {//code in your second post} ?>sorry i am new to php
-
This reply was modified 8 years, 6 months ago by
csandreas1.
-
This reply was modified 8 years, 6 months ago by
csandreas1.
-
This reply was modified 8 years, 6 months ago by
csandreas1.
Here is the pages i need to activate the zoom
try:
<?php if ( has_post_thumbnail() ) { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; if ( function_exists('cc_zoom_featured_image') ) { cc_zoom_featured_image(); } else { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; the_post_thumbnail( 'tyche-blog-post-image' ); } echo ! is_single() ? '</a>' : ''; } ?>i added that code, but the image dissappeared
does it work with this instead?
<?php if ( has_post_thumbnail() ) { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; if ( function_exists('cc_zoom_featured_image') ) { echo do_shortcode( '[zoom]' ); } else { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; the_post_thumbnail( 'tyche-blog-post-image' ); } echo ! is_single() ? '</a>' : ''; } ?>-
This reply was modified 8 years, 6 months ago by
cubecolour. Reason: oops - forgot the code tags
i added your code but it doesn’t work.
try again – I’ve edited my last reply; I’m multitasking & forgot to include the code tags so the post displayed incorrectly
Warning: Missing argument 1 for cc_zoom_featured_image(), called in /home/tsigjetn/frixsample2.mpoliasma.top/wp-content/themes/tyche/inc/class-tyche.php on line 272 and defined in /home/tsigjetn/frixsample2.mpoliasma.top/wp-content/plugins/featured-image-zoom/featured-image-zoom.php on line 84 Notice: Undefined variable: atts in /home/tsigjetn/frixsample2.mpoliasma.top/wp-content/plugins/featured-image-zoom/featured-image-zoom.php on line 92yep now it works! THanks for your help i will leave a review for the plugin asap. One last thing, where can i edit how much zoom i want? If you check the link page i posted before, the zoom is too much and it loses quality. My image size is 730 x 435
-
This reply was modified 8 years, 6 months ago by
csandreas1.
-
This reply was modified 8 years, 6 months ago by
csandreas1.
OK – I wasn’t testing the code before posting earlier so there were probably errors.
I have now set up the free Tyche theme on a test site with the plugin & this worked for me to replace the block specified earlier:
<?php if ( has_post_thumbnail() ) { if ( function_exists('cc_zoom_featured_image') ) { echo do_shortcode( '[zoom]' ); } else { echo ! is_single() ? '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' : ''; the_post_thumbnail( 'tyche-blog-post-image' ); echo ! is_single() ? '</a>' : ''; } } ?> -
This reply was modified 8 years, 6 months ago by
The topic ‘Need help using this plugin on posts featured images’ is closed to new replies.