Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1412737
    StepUp Team
    Participant

    Hi guys 🙂

    I’m having some problem with my website.

    the blog posts featured image is a link to the jpg itself and not to the post page…

    i think this might happened bacause i made this change with some help from a post here for the “portfolio” posts..

    i added this to my functions:
    // Portfolio Lightbox
    // ========================

    add_action( ‘wp_footer’, ‘portfolio_lightbox’);

    function portfolio_lightbox() {
    if ( is_page_template( ‘template-layout-portfolio.php’ ) ) {
    echo do_shortcode(‘[lightbox selector=”.page-template-template-layout-portfolio .entry-thumb” opacity=”0.875″ prev_scale=”0.75″ prev_opacity=”0.75″ next_scale=”0.75″ next_opacity=”0.75″ orientation=”horizontal” thumbnails=”true”]’);
    }
    }

    function x_featured_image( $cropped = ” ) {

    $stack = x_get_stack();
    $fullwidth = ( in_array( ‘x-full-width-active’, get_body_class() ) ) ? true : false;
    $thumb_id = get_post_thumbnail_id();
    $thumb_url_array = wp_get_attachment_image_src($thumb_id, ‘full’, false);
    $thumb_url = $thumb_url_array[0];

    if ( has_post_thumbnail() ) {

    if ( $cropped == ‘cropped’ ) {
    if ( $fullwidth ) {
    $thumb = get_the_post_thumbnail( NULL, ‘entry-cropped-fullwidth’, NULL );
    } else {
    $thumb = get_the_post_thumbnail( NULL, ‘entry-cropped’, NULL );
    }
    } else {
    if ( $fullwidth ) {
    $thumb = get_the_post_thumbnail( NULL, ‘entry-fullwidth’, NULL );
    } else {
    $thumb = get_the_post_thumbnail( NULL, ‘entry’, NULL );
    }
    }

    switch ( is_singular() ) {
    case true:
    printf( ‘<div class=”entry-thumb”>%s</div>’, $thumb );
    break;
    case false:
    printf( ‘%3$s‘,
    $thumb_url,
    esc_attr( sprintf( __( ‘Permalink to: “%s”‘, ‘__x__’ ), the_title_attribute( ‘echo=0’ ) ) ),
    $thumb
    );
    break;
    }

    }

    }

    is there a way to make it work on “portfolio” and not on “posts”?

    #1412739
    StepUp Team
    Participant
    This reply has been marked as private.
    #1412858
    Thai
    Moderator

    Hi There,

    Please find this:

    $thumb_url = $thumb_url_array[0];

    And change to this:

    global $post;
    $thumb_url = $post->post_type == 'x-portfolio' ? $thumb_url_array[0] : get_permalink();

    Hope it helps 🙂

  • <script> jQuery(function($){ $("#no-reply-1412737 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>