Advertisement
Guest User

page-title

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. <?php
  2. $class = '';
  3. $class2 = '';
  4. if (get_metabox("bg_dark") == "true") {
  5. $class2 = ' class="light"';
  6. } else if (get_metabox("bg_dark") != "false") {
  7. if (tw_option("title_bg_dark")) {
  8. $class2 = ' class="light"';
  9. }
  10. }
  11.  
  12. if (is_singular('post') || is_home()) {
  13. $title = "<h1>" . apply_filters('widget_title', tw_option('blog_title')) . "</h1>";
  14. } elseif(is_singular('portfolio')){
  15. $title = "<h1>" . apply_filters('widget_title', tw_option('port_title')) . "</h1>";
  16. } elseif(is_category()){
  17. $title = "<h1>";
  18. $categories = get_the_category();
  19. $separator = ' ';
  20. $output = '';
  21. if ( ! empty( $categories ) ) {
  22. foreach( $categories as $category ) {
  23. $title .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" alt="' . esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
  24. }
  25. echo trim( $output, $separator );
  26. }
  27. $title .= "</h1>";
  28. } else {
  29. if (is_page()) {
  30. $title = "<h1>" . get_featuredtext() . "</h1>";
  31. if (get_metabox("title_bg_image") != "") {
  32. $bgimage = get_metabox("title_bg_image");
  33. }
  34. if (get_metabox("title_prllx")) {
  35. $class = ' class="bg-parallax"';
  36. }
  37. } else {
  38. $title = "<h1>" . get_featuredtext() . "</h1>";
  39. }
  40. }
  41.  
  42. $breadcrumb = $share = false;
  43. if (get_metabox("breadcrumps") == "true") {
  44. $breadcrumb = true;
  45. } else if (get_metabox("breadcrumps") != "false") {
  46. if (tw_option("breadcrumps")) {
  47. $breadcrumb = true;
  48. }
  49. }
  50.  
  51. $ebreadcrumb = "";
  52. if ($breadcrumb) {
  53. ob_start();
  54. breadcrumbs();
  55. $ebreadcrumb = ob_get_clean();
  56. }
  57.  
  58.  
  59. if (woocommerce_enabled() && get_post_type() == 'product') {
  60. $shop_page_id = woocommerce_get_page_id('shop');
  61. $shop_metabox = get_post_meta($shop_page_id, 'themewaves_' . strtolower(THEMENAME) . '_options', true);
  62. if (!empty($shop_metabox["title_bg_image"])) {
  63. $bgimage = $shop_metabox["title_bg_image"];
  64. }
  65. ob_start();
  66. echo "<h1>";
  67. woocommerce_page_title();
  68. echo "</h1>";
  69. $title = ob_get_clean();
  70. if ($breadcrumb) {
  71. ob_start();
  72. woocommerce_breadcrumb();
  73. $ebreadcrumb = ob_get_clean();
  74. }
  75. }
  76.  
  77.  
  78. $background = isset($bgimage) ? $bgimage : tw_option('title_bg_image');
  79. $style1 = !empty($background) ? (' style="background-image: url(' . esc_url($background) . ')"') : '';
  80.  
  81. if (isset($title)) {
  82. ?>
  83. <!-- Start Feature -->
  84. <section id="page-title"<?php echo $class . $class2 . $style1; ?>>
  85. <!-- Start Container -->
  86. <div class="container">
  87. <?php
  88. if ($breadcrumb) {
  89. echo balanceTags($title);
  90. echo '<div class="waves-breadcrumbs">';
  91. echo balanceTags($ebreadcrumb);
  92. echo '</div>';
  93. } else {
  94. echo balanceTags($title);
  95. }
  96. ?>
  97. </div>
  98. <!-- End Container -->
  99. </section>
  100. <!-- End Feature -->
  101. <?php
  102. }
  103. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement