WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] help with an if statement for magic fields group array (3 posts)

  1. sheriffderek
    Member
    Posted 2 years ago #

    i have this group i'm displaying (magic fields v1)

    and when there is nothing to display - i have got it to show nothing...

    but there is a header still there... with nothing below it...
    i would actually like to find a way to just not display that header at all... but since i haven't been able to...

    i was wanting an if statement that would at least put some text there...
    (no info at this time) etc.

    here is my code.

    <h2 class="artist-box-header">press</h2>
    
    			<div id="press-box">
    
    				<?php $myEvent = get_group('press'); // use the Custom Group name
    
    					if($myEvent) {
    
      					foreach($myEvent as $event){ ?>
    
      						<div class="press">
      							<div class="press-quote">
      								<?php echo $event['press_quote'][1]; ?>
      							</div>
    
      							<div class="press-source">
      								<?php echo $event['press_source'][1]; ?>
      							</div>
      						</div><!--end press-->
    
      				<?php }} ?>
    
    			</div> <!--end press-box-->

    any ideas?

  2. sheriffderek
    Member
    Posted 2 years ago #

    so - i figured it out by reading this post on PHP.net

    here is my code incase it helps anyone... just including the last part...

    </div><!--end press-->
    
      				<?php } ?>
    
      				 <?php } else {?>
      					<h1>PLEASE WORK</h1>
      					<?php } ?>

    seems like the error is just kinda silly... you just have to move the bracket ???

    the problem only arises when wrapping with html...

  3. sheriffderek
    Member
    Posted 2 years ago #

    resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic