Jump to content
Danihamer

Urgent! Need to remove a certain Staff div from my webpage

Recommended Posts

Hello! As you can see on my site there are three sections that include members with pictures. I need to only remove the middle one ( I have uploaded a picture that shows the exact section). I have located the point where the code is but I am not sure of what I should delete for I am afraid it might break the site. The website is www.gpseminars.gr and here is the part of the code I believe needs to be modified.

 

<!--- ============  STAFFS  =========== ------------>
<div class="clear"></div>
<div id="staff-box-item">
    <h2 class="boxtoptitle" ><?php echo esc_attr(innovation_get_option('staffboxes-heading', 'WE ARE INSIDE')); ?></h2>
    <h4 class="boxtopdes" ><?php echo esc_textarea(innovation_get_option('staffboxes-heading-des', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua')); ?></h4>
    
            <div id="grid-staff" class="main">
                <?php foreach (range(1, 3 ) as $staffboxsnumber ) { ?>
                <div class="view-staff" >
                    <div class="view-staff-name">
                    <h3><?php echo esc_attr(innovation_get_option('staffboxes-title' . $staffboxsnumber, 'OUR PROUD STAFF '. $staffboxsnumber )); ?></h3>
                    <p><?php echo esc_attr(innovation_get_option('staffboxes-description' . $staffboxsnumber, 'Service Executive' )); ?></p>
                    </div>
                    
                    <div class="view-staff-back social-link">
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linka' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linkb' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linkc' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a class="profile-link" href="<?php echo esc_url(innovation_get_option('staffboxes-link' . $staffboxsnumber, '#' )); ?>">&rarr;</a>
                    </div>
                    <img src="<?php echo esc_url(innovation_get_option('staffboxes-image' . $staffboxsnumber, get_template_directory_uri() . '/images/stf'.  $staffboxsnumber . '.jpg')); ?>" />
                
                </div>
                   <?php } ?>
            </div>
          
</div>

<!--- ============  END OF STAFFS  =========== ------------>

 

 

 

THANK YOU IN ADVANCE.

παρτ.PNG

Share this post


Link to post
Share on other sites

After you have backed up your file change the parameters of the range  function from 1,3 to 2,2, and eliminate the div tag containing the information for the individual whom you want to remove.

Share this post


Link to post
Share on other sites

Create array to hold the identifier to remove, and create if condition

<?php 
$do_not_displayArray[2];
foreach (range(1, 3 ) as $staffboxsnumber ) { 
  if(!in_array($staffboxsnumber, $do_not_displayArray)){ 
?>
                <div class="view-staff" >
                    <div class="view-staff-name">
                    <h3><?php echo esc_attr(innovation_get_option('staffboxes-title' . $staffboxsnumber, 'OUR PROUD STAFF '. $staffboxsnumber )); ?></h3>
                    <p><?php echo esc_attr(innovation_get_option('staffboxes-description' . $staffboxsnumber, 'Service Executive' )); ?></p>
                    </div>
                    
                    <div class="view-staff-back social-link">
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linka' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linkb' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a href="<?php echo esc_url(innovation_get_option('staffboxes-linkc' .$staffboxsnumber, 'http://wordpress.org' )); ?>"></a>
                        <a class="profile-link" href="<?php echo esc_url(innovation_get_option('staffboxes-link' . $staffboxsnumber, '#' )); ?>">→</a>
                    </div>
                    <img src="<?php echo esc_url(innovation_get_option('staffboxes-image' . $staffboxsnumber, get_template_directory_uri() . '/images/stf'.  $staffboxsnumber . '.jpg')); ?>" />
                
                </div>
                   <?php }
     }
?>

 

Edited by dsonesuk

Share this post


Link to post
Share on other sites

Actually thinking about it, you could just add 3rd step parameter of 2 to give same result

foreach (range(1, 3, 2 ) as $staffboxsnumber ) {

//rest of code

}

Edited by dsonesuk

Share this post


Link to post
Share on other sites
1 hour ago, dsonesuk said:

Actually thinking about it, you could just add 3rd step parameter of 2 to give same result

foreach (range(1, 3, 2 ) as $staffboxsnumber ) {

//rest of code

}

Can you please show me exactly where to add the code you have posted? before the one I have posted or should I erase mine and write yours?

Share this post


Link to post
Share on other sites

Just comment out your original and paste in new

<?php 
//old original foreach (range(1, 3 ) as $staffboxsnumber ) {

//new code
foreach (range(1, 3, 2 ) as $staffboxsnumber ) { 
  ?>

If you want to use array version

<?php 
// old original foreach (range(1, 3 ) as $staffboxsnumber ) { 

//new code
$do_not_displayArray[2];
foreach (range(1, 3 ) as $staffboxsnumber ) { 
  if(!in_array($staffboxsnumber, $do_not_displayArray)){ 
  ?>

<?php
}} //two closing curly brackets instead of one, one for foreach, other for if condition
?>

 

Share this post


Link to post
Share on other sites
On 28/4/2017 at 2:50 PM, dsonesuk said:

Just comment out your original and paste in new


<?php 
//old original foreach (range(1, 3 ) as $staffboxsnumber ) {

//new code
foreach (range(1, 3, 2 ) as $staffboxsnumber ) { 
  ?>

If you want to use array version


<?php 
// old original foreach (range(1, 3 ) as $staffboxsnumber ) { 

//new code
$do_not_displayArray[2];
foreach (range(1, 3 ) as $staffboxsnumber ) { 
  if(!in_array($staffboxsnumber, $do_not_displayArray)){ 
  ?>

<?php
}} //two closing curly brackets instead of one, one for foreach, other for if condition
?>

 

Thank you so much!! It worked perfectly!!!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...