WordPress.org

Support

Support » Plugins and Hacks » Custom template help

Custom template help

  • Great plugin, but I’m having a bit of trouble with my output.

    In my functions.php I have –

    add_filter('images_cpt','my_image_cpt');
        function my_image_cpt(){
            $cpts = array('page');
            return $cpts;
        }
    
    add_filter('list_images','my_list_images');
        function my_list_images(){
            $picts = array(
                'image1' => '_image1',
                'image2' => '_image2',
                'image3' => '_image3',
                'image4' => '_image4',
            );
            return $picts;
        }

    I want to print the 4 images in each page automatically. So I put this into my template.php –

    <?php
    get_images_ids(false,id);
    array(
        [0]  => 45,
        'image1' => '_image1',
        'image2' => '_image2',
        'image3' => '_image3',
        'image4' => '_image4'
    );
    ?>

    On the frontend, I get this error – Error while parsing PHP: syntax error, unexpected ‘[‘, expecting ‘)’

    Could anyone point me in the right direction?

    thanks.

    http://wordpress.org/extend/plugins/multi-image-metabox/

Viewing 1 replies (of 1 total)
  • Plugin Author Willy Bahuaud

    @willybahuaud

    Hello,

    You can retrieve your liked pictures using, inside of the WordPress loop :

    $imgs  = get_images_src('your-custom-size');
    foreach( $imgs as $i )
    echo '<img src="' . $i[0] . '">';

    If you want to retrive this images outside of a loop, or for another post, you can ad other parameters to get_images_src(). More information here.

    Thanks for using my plugin !

    🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Custom template help’ is closed to new replies.