Jump to content

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


Danihamer

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

Link to comment
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.

Link to comment
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
Link to comment
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?

Link to comment
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
?>

 

Link to comment
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!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...