0

I am trying to add this if statement

<?php 
 if( wc_memberships_is_user_member( null, 3171 ) ) {
                                                                        
}
?>  

to work with this code

<input id="facebook" class="form-control" type="url" name="user[facebook]" value="<?php echo !empty($facebook) ? esc_attr($facebook) : ''; ?>" placeholder="<?php esc_html_x('Enter your facebook url', 'placeholder', 'direo'); ?>" />

and i am ruining it like so

 <?php 
if( wc_memberships_is_user_member( null, 3171 ) ) {
<input id="facebook" class="form-control" type="url" name="user[facebook]" value="<?php echo !empty($facebook) ? esc_attr($facebook) : ''; ?>" placeholder="<?php esc_html_x('Enter your facebook url', 'placeholder', 'direo'); ?>" />
}
?>

But a I am getting error :

"Parse error: syntax error, unexpected '<' in the line that starts with "<input id="facebook"

what am i doing wrong, please help

Paul T.
  • 4,703
  • 11
  • 25
  • 29
redlaw
  • 37
  • 4

1 Answers1

0

You can't place html elements inside php, you need to end your php code before the html element and start php again after it.

<?php 
if( wc_memberships_is_user_member( null, 3171 ) ) {
?>
<input id="facebook" class="form-control" type="url" name="user[facebook]" value="<?php echo !empty($facebook) ? esc_attr($facebook) : ''; ?>" placeholder="<?php esc_html_x('Enter your facebook url', 'placeholder', 'direo'); ?>" />
<?php
}
?>
Some Guy
  • 126
  • 9