badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

Trying to add a phone number to the header area

Tagged: 

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #8004
    Riou
    Participant

    Hello?

    #8006
    stefanovd85
    Member

    Riou, if it helps, I was only able to add this fiction with the parent theme. I was never able to get the child theme to work.

    #8046
    Sanjip Shah
    Participant

    @Riou I repeated this and it is working fine. I have pasted the code of functions.php file

    <?php 
    add_action( 'init', 'attitude_remove_parent_function' );
    /**
    * Removes parent function attached to hook
    */
    function attitude_remove_parent_function(){
    	remove_action( 'attitude_header', 'attitude_child_headerdetails', 10 );
    }
    
    add_action( 'attitude_header', 'attitude_child_headerdetails', 10 );
    /**
     * Shows Header Part Content
     *
     * Shows the site logo, title, description, searchbar, social icons etc.
     */
    function attitude_child_headerdetails() {		
    ?>
    	<?php
    		global $attitude_theme_options_settings;
       	$options = $attitude_theme_options_settings;
    
       	$elements = array();
    		$elements = array( 	$options[ 'social_facebook' ], 
    									$options[ 'social_twitter' ],
    									$options[ 'social_googleplus' ],
    									$options[ 'social_linkedin' ],
    									$options[ 'social_pinterest' ],
    									$options[ 'social_youtube' ],
    									$options[ 'social_vimeo' ],
    									$options[ 'social_flickr' ],
    									$options[ 'social_tumblr' ],
    									$options[ 'social_myspace' ],
    									$options[ 'social_rss' ]
    							 	);	
    
    		$flag = 0;
    		if( !empty( $elements ) ) {
    			foreach( $elements as $option) {
    				if( !empty( $option ) ) {
    					$flag = 1;
    				}
    				else {
    					$flag = 0;
    				}
    				if( 1 == $flag ) {
    					break;
    				}
    			}
    		}
    	?>
    
    	<div class="container clearfix">
    		<div class="hgroup-wrap clearfix">
    			<a class="telnumber" href="tel:240-415-8323">Call Now: 240-415-8323</a>
    			<?php 
    				if( 0 == $options[ 'hide_header_searchform' ] || 1 == $flag ) {
    			?>
    					<section class="hgroup-right">
    						<?php attitude_socialnetworks( $flag ); ?>
    						<?php if( 0 == $options[ 'hide_header_searchform' ] ) get_search_form(); ?>
    					</section><!-- .hgroup-right -->	
    			<?php
    				}
    			?>
    				<hgroup id="site-logo" class="clearfix">
    					<?php 
    						if( $options[ 'header_show' ] != 'disable-both' && $options[ 'header_show' ] == 'header-text' ) {
    						?>
    							<h1 id="site-title"> 
    								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    									<?php bloginfo( 'name' ); ?>
    								</a>
    							</h1>
    							<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
    						<?php
    						}
    						elseif( $options[ 'header_show' ] != 'disable-both' && $options[ 'header_show' ] == 'header-logo' ) {
    						?>
    							<h1 id="site-title"> 
    								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    									<img src="<?php echo $options[ 'header_logo' ]; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
    								</a>
    							</h1>
    						<?php
    						}
    						?>
    					
    				</hgroup><!-- #site-logo -->
    			
    		</div><!-- .hgroup-wrap -->
    	</div><!-- .container -->	
    	<?php $header_image = get_header_image();
    			if( !empty( $header_image ) ) :?>
    				<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
    			<?php endif; ?>	
    	<?php
    		if ( has_nav_menu( 'primary' ) ) { 
    			$args = array(
    				'theme_location'    => 'primary',
    				'container'         => '',
    				'items_wrap'        => '<ul class="root">%3$s</ul>' 
    			);
    			echo '<nav id="access" class="clearfix">
    					<div class="container clearfix">';
    				wp_nav_menu( $args );
    			echo '</div><!-- .container -->
    					</nav><!-- #access -->';
    		}
    		else {
    			echo '<nav id="access" class="clearfix">
    					<div class="container clearfix">';
    				wp_page_menu( array( 'menu_class'  => 'root' ) );
    			echo '</div><!-- .container -->
    					</nav><!-- #access -->';
    		}
    	?> 		
    		<?php	
    		if( 'above-slider' == $options[ 'slogan_position' ] &&  ( is_home() || is_front_page() ) ) 
    			if( function_exists( 'attitude_home_slogan' ) )
    				attitude_home_slogan(); 
    
    		if( is_home() || is_front_page() ) {
    			if( "0" == $options[ 'disable_slider' ] ) {
    				if( function_exists( 'attitude_pass_cycle_parameters' ) ) 
       				attitude_pass_cycle_parameters();
       			if( function_exists( 'attitude_featured_post_slider' ) ) 
       				attitude_featured_post_slider();
       		}
    		}
    		else { 
    			if( ( '' != attitude_header_title() ) || function_exists( 'bcn_display_list' ) ) { 
    		?>
    			<div class="page-title-wrap">
    	    		<div class="container clearfix">
    	    			<?php
    		    		if( function_exists( 'attitude_breadcrumb' ) )
    						attitude_breadcrumb();
    					?>
    				   <h3 class="page-title"><?php echo attitude_header_title(); ?></h3><!-- .page-title -->
    				</div>
    	    	</div>
    	   <?php
    	   	}
    		} 
    		if( 'below-slider' == $options[ 'slogan_position' ] && ( is_home() || is_front_page() ) ) 
    			if( function_exists( 'attitude_home_slogan' ) )
    				attitude_home_slogan(); 
    
    }
    ?>
    #8792
    Schmalitz
    Participant

    Hi all,

    @Sanjip Shah – I think there is a tiny little mistake in your code – line 6-7. Your code is:

    function attitude_remove_parent_function(){
    	remove_action( 'attitude_header', 'attitude_child_headerdetails', 10 );

    …which didn’t work for me. It should be like the following instead:

    function attitude_remove_parent_function(){
    	remove_action( 'attitude_header', 'attitude_headerdetails', 10 );

    That made it for me. Otherwise these lines are removing the action/function you actually want to add in the next lines. Do you agree?

    I’m not an expert at all but if you agree you could maybe change the orginal code on page 1 of this thread. It took me quite a while to find out. Thank you very muich for your help anyway!

    Kind regards
    Schmalitz

    #8821

    Hi Riou
    Please create your own thread and post your comment clearly what you actually want to do? Make a clear about it.

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.