';
$home = __('Home', 'ishop'); // text for the 'Home' link
$before = ''; // tag before the current crumb
$after = ' '; // tag after the current crumb
echo '
';
global $post;
$homeLink = esc_url(home_url('/'));
echo '' . $home . ' ' . $delimiter . ' ';
if (is_category()) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0)
echo (get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
echo $before . __('Archive by category "','ishop') . single_cat_title('', false) . '"' . $after;
} elseif (is_day()) {
echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo '' . get_the_time('F') . ' ' . $delimiter . ' ';
echo $before . get_the_time('d') . $after;
} elseif (is_month()) {
echo '' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo $before . get_the_time('F') . $after;
} elseif (is_year()) {
echo $before . get_the_time('Y') . $after;
} elseif (is_single() && !is_attachment()) {
if (get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '' . $post_type->labels->singular_name . ' ' . $delimiter . ' ';
echo $before . esc_html(get_the_title()) . $after;
} else {
$cat = get_the_category();
$cat = $cat[0];
echo $brdparentschema . get_category_parents($cat, TRUE, ' ' . $delimiter . ' ') . $after;
echo $before . esc_html(get_the_title()) . $after;
}
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
//$cat = get_the_category($parent->ID); $cat = $cat[0];
//echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo '' . esc_attr($parent->post_title). ' ' . $delimiter . ' ';
echo $before . esc_html(get_the_title()) . $after;
} elseif (is_page() && !$post->post_parent) {
echo $before . esc_html(get_the_title()) . $after;
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '' . esc_html(get_the_title($page->ID)) . ' ';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb)
echo $crumb . ' ' . $delimiter . ' ';
echo $before . esc_html(get_the_title()) . $after;
} elseif (is_search()) {
echo $before . __('Search results for "','ishop') . get_search_query() . '"' . $after;
} elseif (is_tag()) {
echo $before . __('Posts tagged "','ishop') . single_tag_title('', false) . '"' . $after;
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
echo $before . __('Articles posted by ','ishop') . esc_attr($userdata->display_name) . $after;
} elseif (is_404()) {
echo $before . __('Error 404','ishop') . $after;
}
if (get_query_var('paged')) {
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
echo ' (';
echo __('Page','ishop') . ' ' . get_query_var('paged','ishop');
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
echo ')';
}
echo ' ';
}
/* ----------------------------------------------------------------------------------- */
/* Pagination
/*----------------------------------------------------------------------------------- */
if ( ! function_exists( 'ishop_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
*/
function ishop_paging_nav() {
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $wp_query->max_num_pages,
'current' => $paged,
'mid_size' => 2,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( '« Previous', 'ishop' ),
'next_text' => __( 'Next »', 'ishop' ),
'type' => 'list',
) );
if ( $links ) :
?>
'' . ' ' . ( $req ? ' * ' : '' ) . '
' .
'
',
'email' => '' . ' ' . ( $req ? ' * ' : '' ) . '
' .
'
',
'url' => ''
);
return $fields;
}
add_filter( 'comment_form_defaults', 'ishop_comment_form' );
function ishop_comment_form( $argsbutton ) {
$argsbutton['class_submit'] = 'button expand';
return $argsbutton;
}
/* ----------------------------------------------------------------------------------- */
/* Custom Search Form
/*----------------------------------------------------------------------------------- */
function ishop_search_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'ishop_search_form' );
///////////////////Menu
/**
* Primary Menu
*/
function ishop_display_primary_menu() {
wp_nav_menu( array(
'theme_location' => 'topmenu',
'menu' => 'Top Menu',
'container' => false, // remove nav container
'container_class' => '', // class of container
'menu_class' => 'top-bar-menu right', // adding custom nav class
'before' => '', // before each link
'after' => '', // after each link
'link_before' => '', // before each link text
'link_after' => '', // after each link text
'depth' => 5, // limit the depth of the nav
'fallback_cb' => false, // fallback function (see below)
'walker' => new top_bar_walker()
) );
}
/**
* Customized menu output
*/
class top_bar_walker extends Walker_Nav_Menu {
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
$element->has_children = !empty( $children_elements[$element->ID] );
$element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
$element->classes[] = ( $element->has_children ) ? 'has-dropdown not-click' : '';
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
$item_html = '';
parent::start_el( $item_html, $object, $depth, $args );
$classes = empty( $object->classes ) ? array() : (array) $object->classes;
if ( in_array('label', $classes) ) {
$item_html = preg_replace( '/]*>(.*)<\/a>/iU', '$1 ', $item_html );
}
if ( in_array('divider', $classes) ) {
$item_html = preg_replace( '/ ]*>( .* )<\/a>/iU', '', $item_html );
}
$output .= $item_html;
}
function start_lvl( &$output, $depth = 0, $args = array() ) {
$output .= "\n