Reply To: Center Align Featured Images

Homepage Community Forums Epik Theme Support Center Align Featured Images Reply To: Center Align Featured Images

#4237
Dinesh Sharma
Customer

    Yes you are right. That is one thing I am working on.

    But still even if I make them of same size (a smaller size) I would like to center align them. And if I get to center align them above post text, then may be I can work with any image size.

    The problem is that Genesis does not add images in a separate DIV. Which makes difficult to manipulate them from CSS.

    I have found a way to add a image and content in a separate DIV now using following Genesis hook, and now able to center align images, apply borders etc. But there is some problem with this code. I am not able to see more than two posts with this hook active. Trying to figure out that.

    <?php
    /** Change the featured image */
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    add_action(‘genesis_post_content’,’ibfy_post_image’, 0) ;
    function ibfy_post_image() {
    if (  ! is_singular() ) {
    $img = genesis_get_image( array( ‘format’ => ‘html’, ‘size’ => genesis_get_option( ‘image_size’ ), ‘attr’ => array( ‘class’ => ‘post-image’ ) ) );
    printf( ‘<div class=”featured-image”><a href=”%s” title=”%s”>%s</a></div>’, get_permalink(), the_title_attribute( ‘echo=0’ ), $img );
    echo genesis_do_post_content();
    }
    }
    ?>

    Anyway Thanks for the reply.