• Hi, I am trying to create a if sequense, but I don’t have any luck:

    <?php // Works inside of the Loop
    function function_name() {
    global $post;
    $thePostID = $post->ID;
    } ?>
    <?php foreach(get_field('matcher') as $matcher): ?>
    <?php foreach( get_post_meta($matcher->ID, 'vinnare') as $vinnare): ?>
    <?php foreach( get_post_meta($matcher->ID, 'vinnarenamn') as $vinnarenamn): ?>
    <?php foreach( get_post_meta($matcher->ID, 'forlorarenamn') as $forlorarenamn): ?>							
    
    <?php echo $thePostID          /// Just for testing?>
    <?php echo $vinnare ?>
    <?php if ($vinnare == $thePostID) { ?>
    Test
    <?php }?>

    My problem is that the $thePostID don’t return any value – so I guess thats why the if statement don’t work…
    Can anybody help me?

Viewing 1 replies (of 1 total)
  • $thePostID gets assigned a value inside the function function_name(). Your code never calls this function so the assignment is never executed…

Viewing 1 replies (of 1 total)

The topic ‘If problems’ is closed to new replies.