Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #253007

    I’ve removed only the titles from the header (leaving the breadcrumbs) for a client via the functions-enfold.php file, but of course every time they update the theme I have to jump back in there and remove the code again. Is there any way you could instruct me on how to handle this via the child theme?

    Thanks so much…

    ex: http://crcamerica.org/education/

    #253597

    Hi sky19er!

    Any function that starts out with if(!function_exists can be replace in your child theme by declaring the same function without the check to see if it already exists.

    Cheers!
    Devin

    #253622

    OK, I don’t really know php, so, my best guess based on your reply was to create a functions-enfold.php file with the following code — with the title removed in the html line of the default array — and upload that to the enfold-child folder. This didn’t work for me. I tried chopping out some of the stuff above and below the array, but nothing worked. Can you tell me what I’m doing wrong?

    
    <?php
        
    	function avia_title($args = false, $id = false)
    	{
    		global $avia_config;
    
    		if(!$id) $id = avia_get_the_id();
    		
    		$header_settings = avia_header_setting();
    		if($header_settings['header_title_bar'] == 'hidden_title_bar') return "";
    		
    		$defaults 	 = array(
    
    			'title' 		=> get_the_title($id),
    			'subtitle' 		=> "", //avia_post_meta($id, 'subtitle'),
    			'link'			=> get_permalink($id),
    			'html'			=> "<div class='{class} title_container'><div class='container'>{additions}</div></div>",
    			'class'			=> 'stretch_full container_wrap alternate_color '.avia_is_dark_bg('alternate_color', true),
    			'breadcrumb'	=> true,
    			'additions'		=> "",
    			'heading'		=> 'h1' //headings are set based on this article: http://yoast.com/blog-headings-structure/
    		);
    
    		if ( is_tax() || is_category() || is_tag() )
    		{
    			global $wp_query;
    
    			$term = $wp_query->get_queried_object();
    			$defaults['link'] = get_term_link( $term );
    		}
    		else if(is_archive())
    		{
    			$defaults['link'] = "";
    		}
    		
    		//disable breadcrumb if requested
    		if($header_settings['header_title_bar'] == 'title_bar') $defaults['breadcrumb'] = false;
    
    		// Parse incomming $args into an array and merge it with $defaults
    		$args = wp_parse_args( $args, $defaults );
    		$args = apply_filters('avf_title_args', $args, $id);
    
    		// OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
    		extract( $args, EXTR_SKIP );
    
    		if(empty($title)) $class .= " empty_title ";
            $markup = avia_markup_helper(array('context' => 'avia_title','echo'=>false));
    		if(!empty($link)) $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".esc_attr( $title )."' $markup>".$title."</a>";
    		if(!empty($subtitle)) $additions .= "<div class='title_meta meta-color'>".wpautop($subtitle)."</div>";
    		if($breadcrumb) $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
    
    		$html = str_replace('{class}', $class, $html);
    		$html = str_replace('{title}', $title, $html);
    		$html = str_replace('{additions}', $additions, $html);
    		$html = str_replace('{heading}', $heading, $html);
    
    		if(!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview())
    		{
    			$avia_config['small_title'] = $title;
    		}
    		else
    		{
    			return $html;
    		}
    	}
    	?>
    
    #253669

    Hey!

    Thank you for the update.

    How did you remove the title? I mean what are the codes that you strip out to remove the title and leave the breadcrumbs. Instead of copying the whole function, you can use the filter hook to remove the title:

    add_filter('avf_title_args', 'avf_remove_header_title', 10, 1);
    function avf_remove_header_title($args) {
        $args['title'] = '';
        return $args;
    }
    

    Best regards,
    Ismael

    #254186

    I removed <{heading} class='main-title entry-title'>{title}</{heading}> from line 274 of functions-enfold.php.

    So, now I tried putting the following in a functions-enfold.php file and uploaded it to the enfold-child folder, but it didn’t work:

    	<?php
    add_filter('avf_title_args', 'avf_remove_header_title', 10, 1);
    function avf_remove_header_title($args) {
        $args['title'] = '';
        return $args;
    }
    	?>

    Anything else I can try?
    Thanks!

    #254300

    Hi!

    Thank you for the update.

    Please don’t import the functions-enfold.php file on the child theme folder. Place the code suggested above on the child theme’s functions.php. It should work.

    Cheers!
    Ismael

    #254528

    Aha! I thought to try that, but didn’t for some reason — that did it! Thank you!!!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Remove titles via child theme’ is closed to new replies.