Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author HK

    (@hk1993)

    Using following code you can display the images on pages / posts

    <?php
    $post_id = get_the_ID();
    $result = get_post_meta($post_id, ‘vdw_gallery_id’, true);
    print_r($result);
    ?>

    Hey there, I have the same question.

    Where do I insert the code above? I am running on genesis and have added this to my functions.php in an effort to output gallery images. I’d like the ability to format them using html markup. Help appreciated ?? thanks

    //IMAGE GALLERY ON POST PAGES
    add_action( ‘genesis_before_content’, ‘single_post_gallery’, 5 );

    function single_post_gallery() {

    if ( ! is_singular( ‘post’ ) )
    return;

    $post_id = get_the_ID();
    $result = get_post_meta($post_id, ‘vdw_gallery_id’, true);
    print_r($result);

    }

    Thread Starter Radu33

    (@radu33)

    Hey Vickiejv,

    I actually gave up on this plugin due to lack of functionality, but I’m using now the ACF plugin which has the built in gallery builder and is really easy to use: https://www.advancedcustomfields.com/resources/gallery/

    You can use the free version as well.

    Best Regards,
    Radu

    Hey Radu,

    Thanks, I’ve got ACF open now ??

    Cheers,

    Vickie

    Plugin Author HK

    (@hk1993)

    Hello vickiejv,

    You may use this code to display using html markup..

    
    function property_slideshow($content) {
        if (is_single() && 'post' == get_post_type()) {
            $post_id = get_the_ID();
            $result = get_post_meta($post_id, 'vdw_gallery_id', true);
            foreach ($result as $val) {
                $img = wp_get_attachment_image_src($val, 'full');
                $images .= "<img src='$img[0]' class='post-image'>";
            }
            return $content . $images;
        }
    }
    
    add_filter('the_content', 'property_slideshow');
    

    Default wordpress gallery output:

    
    $vdw_gallery = get_post_meta(get_the_ID(), 'vdw_gallery_id', true);
    if ($vdw_gallery) {
        echo do_shortcode('[gallery ids="'.implode(",", $vdw_gallery).'"]');
    }
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display images on pages?’ is closed to new replies.