Home Forums Add-ons Gallery Field Output of gallery in "plain php"


Output of gallery in "plain php"

  • Hi there,

    I’m still learning PHP and this is for sure just a syntax problem:
    I’m trying to output the gallery (basic list of images from here: in “plain PHP”.
    I’ve already tried almost everything, but nothing seems to work. This is what I have so far at this moment and it causes a white screen:

    $members = get_field('team_member');
    if( $members ):
        echo ='<ul>';
            foreach( $members as $member ):
                echo ='<li>';
                echo ='<a href="' . $member['url'] . '">';
                echo ='<img src="' . $member['sizes']['large'] . '" alt="' . $member['alt'] . '">';
                echo ='</a>';
                echo ='<p>' . $member['caption'] . '</p>';
                echo ='</li>';
        echo ='</ul>';

    Could anyone help me a bit with this, please?

  • Since you’re just starting out, the first thing you should do if you’re going to be working on code is to enable debugging. Doing so will let you see the errors that your page is producing rather than a white screen.

    You’ve got multiple syntax errors, mainly the = after each echo. Remove them.

  • Thanks a lot for the quick reply, John! To put = after echo is (of course!) a very stupid failing. I can not believe I did not see that :-/. Very emberassing, it’s time for vacation. Maybe you can delete this useless thread.
    WP_DEBUG I will set on true, from now on. That would have helped a lot in this case.

  • I honestly didn’t see the = thing till I copied your code into my edit and it showed me the errors, it’s amazing the things that can be easily overlooked, especially if you make an error on one line and then copy and paste that line to created another one.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Output of gallery in "plain php"’ is closed to new replies.