small PHP Syntax issue with custom field
-
Hello! I am trying to use a piece of script to a template from the Facebook Photo Fetcher plugin and insert a number from a custom field so that different albums can be placed on different pages.
That may be confusing, but I think the solution is simple and just a little syntax problem on my end 🙂
Here is the original code. I placed this as is in my template file and it loads perfectly on the page.
<?php $album = fpf_fetch_album_content( '315484822640', array('isPage'=>1, 'cols'=>3, 'rand'=>6, 'hideHead'=>1) ); echo "<a href='javascript:document.location.reload();'><small><em>refresh the page for new images</em></small></a>"; echo $album['content'] ?>Now what I want to do is replace the number
'315484822640'with a number from a custom field input.<?php if(get_post_meta($post->ID, 'facebook number', true)) : ?> <?php $album = fpf_fetch_album_content( ' <?php echo get_post_meta($post->ID, 'facebook number', true); ?> ', array('isPage'=>1, 'cols'=>3, 'rand'=>6, 'hideHead'=>1) ); echo "<a href='javascript:document.location.reload();'><small><em>refresh the page for new images</em></small></a>"; echo $album['content'] ?> <?php else : ?> <?php endif; ?>The problem in the code is putting a “<?php…..?>” inside another “<?php…..?>”
any help would be greatly appreciated!
The topic ‘small PHP Syntax issue with custom field’ is closed to new replies.