Support » Plugin: Multi Image Metabox » Custom template help

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

    In my functions.php I have –

        function my_image_cpt(){
            $cpts = array('page');
            return $cpts;
        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 –

        [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?


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



    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.