![]() |
Wordpress: unexpected T_STRING error
I have a custom field named galleries that is producing the "Parse error: syntax error, unexpected T_STRING" error.
galleries field has the server location of a gallery ( /home/www/gallery1.php ) If I hardcode the link in the template it works Code:
<?php include('/home/www/gallery1.php'); ?> Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?> Whats wrong with this line? :helpme |
Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?> The immediate reason you get T_STRING error is because you have single quotes within single quotes. Also the use of include is incorrect and unnecessary.. Just do <?php echo get_post_meta($post->ID, 'galleries', true); ?> |
Quote:
If I use just the <?php echo get_post_meta($post->ID, 'galleries', true); ?> it just prints out the location of the gallery /home/www/gallery1.php What I'm trying to do is include a html page within the template. |
If figured it out.
I set the custom field as a variable, then used that var in the include. |
<?php include(get_post_meta($post->ID, 'galleries', true)); ?>
Thats probably what you wanted if the path is correct. |
Quote:
Thanks! |
ya you had a <?php inside a <?php ;)
|
Quote:
|
this thread delivers
|
All times are GMT -7. The time now is 02:56 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc