• Resolved csandreas1

    (@csandreas1)


    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 7 years, 2 months ago by csandreas1.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author cubecolour

    (@numeeja)

    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();
        }
    
    Thread Starter csandreas1

    (@csandreas1)

    What is the default wordpress code that calls featured image?

    • This reply was modified 7 years, 2 months ago by csandreas1.
    Plugin Author cubecolour

    (@numeeja)

    the_post_thumbnail();

    Thread Starter csandreas1

    (@csandreas1)

    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 7 years, 2 months ago by csandreas1.
    • This reply was modified 7 years, 2 months ago by csandreas1.
    • This reply was modified 7 years, 2 months ago by csandreas1.
    Plugin Author cubecolour

    (@numeeja)

    Tyche is a free theme from www.ads-software.com so I have been able to look at the theme’s files. The the_post_thumbnail function is called in template-parts/content.php. It not advised to edit the theme’s files directly, but to use a child theme to apply the modifications.

    Thread Starter csandreas1

    (@csandreas1)

    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 7 years, 2 months ago by csandreas1.
    • This reply was modified 7 years, 2 months ago by csandreas1.
    • This reply was modified 7 years, 2 months ago by csandreas1.
    Thread Starter csandreas1

    (@csandreas1)

    Here is the pages i need to activate the zoom

    Plugin Author cubecolour

    (@numeeja)

    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>' : '';
    }
    ?>
    
    Thread Starter csandreas1

    (@csandreas1)

    i added that code, but the image dissappeared

    Plugin Author cubecolour

    (@numeeja)

    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 7 years, 2 months ago by cubecolour. Reason: oops - forgot the code tags
    Thread Starter csandreas1

    (@csandreas1)

    i added your code but it doesn’t work.

    Plugin Author cubecolour

    (@numeeja)

    try again – I’ve edited my last reply; I’m multitasking & forgot to include the code tags so the post displayed incorrectly

    Thread Starter csandreas1

    (@csandreas1)

    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 92
    
    Thread Starter csandreas1

    (@csandreas1)

    yep 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 7 years, 2 months ago by csandreas1.
    • This reply was modified 7 years, 2 months ago by csandreas1.
    Plugin Author cubecolour

    (@numeeja)

    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>' : '';
            }
        }
    ?>
    
Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Need help using this plugin on posts featured images’ is closed to new replies.