Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'kleo_title_section' ) ) {
- /**
- * Return the breadcrumb area
- * @global object $wp_query
- *
- * @param array $args
- *
- * @return string
- */
- function kleo_title_section( $args = false ) {
- $defaults = array(
- 'title' => get_the_title(),
- 'show_title' => true,
- 'show_breadcrumb' => true,
- 'link' => '',
- 'output' => "<section class='{class} border-bottom breadcrumbs-container'><div class='container'>{title_data}<div class='breadcrumb-extra'>{breadcrumb_data}{extra}</div></div></section>",
- 'class' => 'container-wrap main-title alternate-color ',
- 'extra' => '<p class="page-info">' . do_shortcode( sq_option( 'title_info', '' ) ) . '</p>',
- 'heading' => 'h1'
- );
- // Parse incoming $args into an array and merge it with $defaults
- $args = wp_parse_args( $args, $defaults );
- $args = apply_filters( 'kleo_title_args', $args );
- // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
- extract( $args, EXTR_SKIP );
- if ( ! empty( $link ) ) {
- $title = "<a href='" . $link . "' rel='bookmark' title='" . __( 'Permanent Link:', 'kleo_framework' ) . " " . esc_attr( $title ) . "'>" . $title . "</a>";
- }
- $breadcrumb_data = '';
- if ( $show_breadcrumb ) {
- $breadcrumb_data = kleo_breadcrumb( array(
- 'show_browse' => false,
- 'separator' => ' ',
- 'show_home' => __( 'Home', 'kleo_framework' ),
- 'echo' => false
- ) );
- }
- $title_data = '';
- if ( $show_title ) {
- $title_data = '<{heading} class="page-title">{title}</{heading}>';
- }
- if ( ! $show_breadcrumb && $extra == '' ) {
- $class .= ' title-single';
- }
- $title_layout = sq_option( 'title_layout', 'normal' );
- if ( is_singular() && get_cfield( 'title_layout' ) && get_cfield( 'title_layout' ) != '' ) {
- $title_layout = get_cfield( 'title_layout' );
- }
- if ( $title_layout == 'center' ) {
- $class .= ' main-center-title';
- } elseif ( $title_layout == 'right_breadcrumb' ) {
- $class .= ' main-right-breadcrumb';
- }
- $current_title = get_the_title();
- $output = str_replace( '{title_data}', $title_data, $output );
- $output = str_replace( '{class}', $class, $output );
- if(class_exists('WooCommerce') && is_woocommerce() ) {
- $output = str_replace('{title}', $current_title, $output);
- } else {
- $output = str_replace( '{title}', $title, $output );
- }
- $output = str_replace( '{breadcrumb_data}', $breadcrumb_data, $output );
- $output = str_replace( '{extra}', $extra, $output );
- $output = str_replace( '{heading}', $heading, $output );
- return $output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement