Guest User

Untitled

a guest
Jan 24th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. function avia_title($args = false, $id = false)
  2. {
  3. global $avia_config;
  4.  
  5. if(!$id) $id = avia_get_the_id();
  6.  
  7. $header_settings = avia_header_setting();
  8. if($header_settings['header_title_bar'] == 'hidden_title_bar') return "";
  9.  
  10. $defaults = array(
  11.  
  12. 'title' => get_the_title($id),
  13. 'subtitle' => "", //avia_post_meta($id, 'subtitle'),
  14. 'link' => get_permalink($id),
  15. 'html' => "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>",
  16. 'class' => 'stretch_full container_wrap alternate_color '.avia_is_dark_bg('alternate_color', true),
  17. 'breadcrumb' => true,
  18. 'additions' => "",
  19. 'heading' => 'h1' //headings are set based on this article: http://yoast.com/blog-headings-structure/
  20. );
  21.  
  22. if ( is_tax() || is_category() || is_tag() )
  23. {
  24. global $wp_query;
  25.  
  26. $term = $wp_query->get_queried_object();
  27. $defaults['link'] = get_term_link( $term );
  28. }
  29. else if(is_archive())
  30. {
  31. $defaults['link'] = "";
  32. }
  33.  
  34.  
  35. // Parse incomming $args into an array and merge it with $defaults
  36. $args = wp_parse_args( $args, $defaults );
  37. $args = apply_filters('avf_title_args', $args, $id);
  38.  
  39. //disable breadcrumb if requested
  40. if($header_settings['header_title_bar'] == 'title_bar') $args['breadcrumb'] = false;
  41.  
  42. //disable title if requested
  43. if($header_settings['header_title_bar'] == 'breadcrumbs_only') $args['title'] = '';
  44.  
  45.  
  46. // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
  47. extract( $args, EXTR_SKIP );
  48.  
  49. if(empty($title)) $class .= " empty_title ";
  50. $markup = avia_markup_helper(array('context' => 'avia_title','echo'=>false));
  51. if(!empty($link) && !empty($title)) $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".esc_attr( $title )."' $markup>".$title."</a>";
  52. if(!empty($subtitle)) $additions .= "<div class='title_meta meta-color'>".wpautop($subtitle)."</div>";
  53. if($breadcrumb) $additions .= avia_breadcrumbs(array('separator' => '/', 'richsnippet' => true));
  54.  
  55.  
  56. $html = str_replace('{class}', $class, $html);
  57. $html = str_replace('{title}', $title, $html);
  58. $html = str_replace('{additions}', $additions, $html);
  59. $html = str_replace('{heading}', $heading, $html);
  60.  
  61.  
  62.  
  63. if(!empty($avia_config['slide_output']) && !avia_is_dynamic_template($id) && !avia_is_overview())
  64. {
  65. $avia_config['small_title'] = $title;
  66. }
  67. else
  68. {
  69. return $html;
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment