-
AuthorPosts
-
April 18, 2014 at 4:45 am #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…
April 20, 2014 at 5:12 pm #253597Hi 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!
DevinApril 20, 2014 at 10:54 pm #253622OK, 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; } } ?>
April 21, 2014 at 6:34 am #253669Hey!
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,
IsmaelApril 22, 2014 at 6:58 am #254186I 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!April 22, 2014 at 1:17 pm #254300Hi!
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!
IsmaelApril 22, 2014 at 6:47 pm #254528Aha! I thought to try that, but didn’t for some reason — that did it! Thank you!!!
-
AuthorPosts
- The topic ‘Remove titles via child theme’ is closed to new replies.