PHP Expert Help Please
2015-08-30, 02:45 AM,
#1
Hi,
On My website (WP Theme) There are Three Footer Widgets, I just need single footer in my website (I will change CSS but i don't know about PHP) So anyone please remove extra footer from this PHP Code.


PHP Code:
<?php
    
if ( ! is_active_sidebar'sidebar-2' ) && ! is_active_sidebar'sidebar-3' ) && ! is_active_sidebar'sidebar-4'  ) )
        return;
?>

<div id="footer-widgets">
    <div class="clearfix container">
    <?php
        $footer_sidebars 
= array( 'sidebar-2''sidebar-3''sidebar-4' );
        foreach ( 
$footer_sidebars as $key => $footer_sidebar ){
            if ( 
is_active_sidebar$footer_sidebar ) ) {
                echo 
'<div class="footer-widget' . (  == $key ' last' '' ) . '">';
                
dynamic_sidebar$footer_sidebar );
                echo 
'</div> <!-- end .footer-widget -->';
            }
        }
    
?>
    </div> <!-- end .container -->
</div> <!-- end #footer-widgets --> 





Thanks In advance
2015-08-30, 03:08 AM,
#2
Well it's easy, just remove the sidebar you don't need like this:

Code:
$footer_sidebars = array( 'sidebar-2' );

Or if you don't want to delete anything just add an extra line:

Code:
<?php
        $footer_sidebars = array( 'sidebar-2', 'sidebar-3', 'sidebar-4' );
        foreach ( $footer_sidebars as $key => $footer_sidebar ){
            if ( is_active_sidebar( $footer_sidebar ) ) {
                echo '<div class="footer-widget' . (  2 == $key ? ' last' : '' ) . '">';
                dynamic_sidebar( $footer_sidebar );
                echo '</div> <!-- end .footer-widget -->';
            }
        break; // break the for loop after the first action
        }
    ?>

This will break the for loop after adding the first footer widget.
Send me a PM with your Skype if this doesn't work somehow!
2015-08-31, 03:33 PM,
#3
(2015-08-30, 03:08 AM)Rkt Wrote: Well it's easy, just remove the sidebar you don't need like this:

Code:
$footer_sidebars = array( 'sidebar-2' );

Or if you don't want to delete anything just add an extra line:

Code:
<?php
        $footer_sidebars = array( 'sidebar-2', 'sidebar-3', 'sidebar-4' );
        foreach ( $footer_sidebars as $key => $footer_sidebar ){
            if ( is_active_sidebar( $footer_sidebar ) ) {
                echo '<div class="footer-widget' . (  2 == $key ? ' last' : '' ) . '">';
                dynamic_sidebar( $footer_sidebar );
                echo '</div> <!-- end .footer-widget -->';
            }
        break; // break the for loop after the first action
        }
    ?>

This will break the for loop after adding the first footer widget.
Send me a PM with your Skype if this doesn't work somehow!

PM sent you about problem.
2015-09-01, 05:16 PM,
#4
Any other php expert here?
2015-09-14, 09:18 AM, (This post was last modified: 2015-09-14, 09:18 AM by Twizze.)
#5
(2015-09-01, 05:16 PM)rajabadariqbal Wrote: Any other php expert here?
Doesn't it answered from post above?
2015-09-14, 11:44 AM,
#6
after doing what he told i faced one more problem but he never replied.
I had sent him several OM,
now I solved it.


Possibly Related Threads...
Thread Author Replies Views Last Post
  Help Needed CPAgrip php script takumi 4 849 2017-01-24, 04:47 AM
Last Post: takumi
  SOME DATA IS NOT BEING INSERTED TO MYSQL DATABASE WITH PHP QwertySon 2 1,170 2016-11-21, 02:52 PM
Last Post: QwertySon
  php + mysql , I need help t0ks1ck 4 1,062 2016-09-19, 01:55 AM
Last Post: styx
  need a php line help t0ks1ck 8 1,067 2016-09-08, 09:01 PM
Last Post: styx
  .Net Expert Required insomniac 6 1,612 2016-09-08, 08:38 PM
Last Post: styx





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top