at path:
ROOT
/
wp-content
/
themes
/
kadu
/
inc
/
template-functions.php
run:
R
W
Run
admin
DIR
2025-12-13 10:18:31
R
W
Run
breadcrumb-init.php
8.85 KB
2024-06-25 08:54:22
R
W
Run
Delete
Rename
class-wp-kadu-navwalker.php
21.13 KB
2024-05-28 06:29:50
R
W
Run
Delete
Rename
cs-framework-functions.php
2.75 KB
2024-07-04 04:06:28
R
W
Run
Delete
Rename
custom-header.php
1.8 KB
2024-05-28 06:29:50
R
W
Run
Delete
Rename
customizer.php
1.6 KB
2024-05-28 06:29:50
R
W
Run
Delete
Rename
dynamic-style.php
1.45 KB
2024-07-04 04:29:24
R
W
Run
Delete
Rename
jetpack.php
1.45 KB
2024-05-28 06:29:50
R
W
Run
Delete
Rename
kadu-functions.php
5.99 KB
2024-07-04 04:07:09
R
W
Run
Delete
Rename
kadu-helper-class.php
2.33 KB
2024-07-04 04:00:37
R
W
Run
Delete
Rename
remove_actions.php
1.41 KB
2023-09-30 10:46:10
R
W
Run
Delete
Rename
template-functions.php
17.14 KB
2024-06-23 05:40:36
R
W
Run
Delete
Rename
template-tags.php
3.69 KB
2024-06-23 12:25:22
R
W
Run
Delete
Rename
error_log
up
📄
template-functions.php
Save
<?php /** * Functions which enhance the theme by hooking into WordPress * * @package kadu */ add_filter('wpcf7_form_elements', function ($content) { $content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content); return $content; }); /** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function kadu_body_classes($classes){ // Adds a class of hfeed to non-singular pages. if (!is_singular()) { $classes[] = 'hfeed'; } // Adds a class of no-sidebar when there is no sidebar present. if (!is_active_sidebar('sidebar-1')) { $classes[] = 'no-sidebar'; } return $classes; } add_filter('body_class', 'kadu_body_classes'); /** * Add a pingback url auto-discovery header for single posts, pages, or attachments. */ function kadu_pingback_header() { if (is_singular() && pings_open()) { printf('<link rel="pingback" href="%s">', esc_url(get_bloginfo('pingback_url'))); } } add_action('wp_head', 'kadu_pingback_header'); /** * Breadcrumb * * @return [type] [return description] */ function kadu_the_breadcrumb() { global $wp_query; $queried_object = get_queried_object(); $breadcrumb = ''; $delimiter = ''; $before = '<li class="breadcrumb-item">'; $after = '</li>'; if (!is_front_page()) { $breadcrumb .= $before . '<a href="' . home_url('/') . '">' . esc_html__('Home', 'kadu') . ' </a>' . $after; /** If category or single post */ if (is_category()) { $cat_obj = $wp_query->get_queried_object(); $this_category = get_category($cat_obj->term_id); if ($this_category->parent != 0) { $parent_category = get_category($this_category->parent); $breadcrumb .= get_category_parents($parent_category, true, $delimiter); } $breadcrumb .= $before . '<a href="' . get_category_link(get_query_var('cat')) . '">' . single_cat_title('', false) . '</a>' . $after; } elseif ($wp_query->is_posts_page) { $breadcrumb .= $before . $queried_object->post_title . $after; } elseif (is_tax()) { $breadcrumb .= $before . '<a href="' . get_term_link($queried_object) . '">' . $queried_object->name . '</a>' . $after; } elseif (is_page()) /** If WP pages */{ global $post; if ($post->post_parent) { $anc = get_post_ancestors($post->ID); foreach ($anc as $ancestor) { $breadcrumb .= $before . '<a href="' . get_permalink($ancestor) . '">' . get_the_title($ancestor) . ' </a>' . $after; } $breadcrumb .= $before . '' . get_the_title($post->ID) . '' . $after; } else { $breadcrumb .= $before . '' . get_the_title() . '' . $after; } } elseif (is_singular()) { if ($category = wp_get_object_terms(get_the_ID(), array('category', 'location', 'tax_feature'))) { if (!is_wp_error($category)) { $breadcrumb .= $before . '<a href="' . get_term_link(kadu_set($category, '0')) . '">' . kadu_set(kadu_set($category, '0'), 'name') . ' </a>' . $after; $breadcrumb .= $before . '' . get_the_title() . '' . $after; } else { $breadcrumb .= $before . '' . get_the_title() . '' . $after; } } else { $breadcrumb .= $before . '' . get_the_title() . '' . $after; } } elseif (is_tag()) { $breadcrumb .= $before . '<a href="' . get_term_link($queried_object) . '">' . single_tag_title('', false) . '</a>' . $after; } /**If tag template*/elseif (is_day()) { $breadcrumb .= $before . '<a href="#">' . esc_html__('Archive for ', 'kadu') . get_the_time('F jS, Y') . '</a>' . $after; } /** If daily Archives */elseif (is_month()) { $breadcrumb .= $before . '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . __('Archive for ', 'kadu') . get_the_time('F, Y') . '</a>' . $after; } /** If montly Archives */elseif (is_year()) { $breadcrumb .= $before . '<a href="' . get_year_link(get_the_time('Y')) . '">' . __('Archive for ', 'kadu') . get_the_time('Y') . '</a>' . $after; } /** If year Archives */elseif (is_author()) { $breadcrumb .= $before . '<a href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '">' . __('Archive for ', 'kadu') . get_the_author() . '</a>' . $after; } /** If author Archives */elseif (is_search()) { $breadcrumb .= $before . '' . esc_html__('Search Results for ', 'kadu') . get_search_query() . '' . $after; } /** if search template */elseif (is_404()) { $breadcrumb .= $before . '' . esc_html__('404 - Not Found', 'kadu') . '' . $after; /** if search template */ } elseif (is_post_type_archive('product')) { $shop_page_id = wc_get_page_id('shop'); if (get_option('page_on_front') !== $shop_page_id) { $shop_page = get_post($shop_page_id); $_name = wc_get_page_id('shop') ? get_the_title(wc_get_page_id('shop')) : ''; if (!$_name) { $product_post_type = get_post_type_object('product'); $_name = $product_post_type->labels->singular_name; } if (is_search()) { $breadcrumb .= $before . '<a href="' . get_post_type_archive_link('product') . '">' . $_name . '</a>' . $delimiter . esc_html__('Search results for “', 'kadu') . get_search_query() . '”' . $after; } elseif (is_paged()) { $breadcrumb .= $before . '<a href="' . get_post_type_archive_link('product') . '">' . $_name . '</a>' . $after; } else { $breadcrumb .= $before . $_name . $after; } } } else { $breadcrumb .= $before . '<a href="' . get_permalink() . '">' . wp_title() . '</a>' . $after; } /** Default value */ } return $breadcrumb; } function kadu_category_html($links) { // Match the category name and number of posts separately $links = preg_replace('/<a href="([^"]+)">([^<]+)<\/a> \((\d+)\)/', '<a href="$1"> <span class="text">$2</span> <span class="number">($3)</span> <span class="icon-1"> <i class="flaticon-left-arrow"></i> </span> </a>', $links); return $links; } add_filter('wp_list_categories', 'kadu_category_html'); function kadu_archive_html($links){ $links = str_replace('</a> (', '<span class="number">', $links); $links = str_replace(')', '</span> <span class="icon-1" > <i class="flaticon-left-arrow"></i> </span></a>', $links); return $links; } add_filter('get_archives_link', 'kadu_archive_html'); /** * Comment Link Class * * @param [type] $class * @return void */ function wpdocs_comment_reply_link_class($class) { $class = str_replace("class='comment-reply-link", "class='comment-reply-link reply-btn", $class); return $class; } add_filter('comment_reply_link', 'wpdocs_comment_reply_link_class'); /** * Comment List Modification */ function kadu_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <div <?php comment_class('comments-box-single wow fadeInUp'); ?> id="comment-<?php comment_ID() ?>"> <?php if (get_avatar($comment)) { ?> <div class="person-img"> <?php echo get_avatar($comment, 80); ?> </div> <?php } ?> <div class="comments-box-author-content"> <div class="heading-wrap"> <div class="title-wrap"> <span class="name"> <?php comment_author_link() ?> </span> <span class="date"> <?php echo esc_html(get_the_time(get_option('date_format'))); ?> </span> </div> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => wp_kses('Reply', true)))); ?> </div> <div class="comment-text"> <?php comment_text(); ?> </div> </div> </div> <?php } /** * Comment Message Box */ function kadu_comment_reform($arg) { $arg['title_reply'] = esc_html__('Leave a comment', 'kadu'); $arg['comment_field'] = '<textarea id="comment" class="form_control" name="comment" cols="77" rows="3" placeholder="' . esc_attr__("Comment", "kadu") . '" aria-required="true"></textarea>'; return $arg; } add_filter('comment_form_defaults', 'kadu_comment_reform'); /** * Comment Form Field */ function kadu_modify_comment_form_fields($fields) { $commenter = wp_get_current_commenter(); $req = get_option('require_name_email'); $fields['author'] = '<div class="row"><div class="col-lg-6 col-md-6 col-sm-12 form-group"><input type="text" name="author" id="author" value="' . esc_attr($commenter['comment_author']) . '" placeholder="' . esc_attr__("Name", "kadu") . '" size="22" tabindex="1"' . ($req ? 'aria-required="true"' : '') . ' class="form_control" /></div>'; $fields['email'] = '<div class="col-lg-6 col-md-6 col-sm-12 form-group"><input type="email" name="email" id="email" value="' . esc_attr($commenter['comment_author_email']) . '" placeholder="' . esc_attr__("Email", "kadu") . '" size="22" tabindex="2"' . ($req ? 'aria-required="true"' : '') . ' class="form_control" /></div>'; $fields['url'] = '<div class="col-lg-12 col-md-12 col-sm-12 form-group"><input type="url" name="url" id="url" value="' . esc_attr($commenter['comment_author_url']) . '" placeholder="' . esc_attr__("Website", "kadu") . '" size="22" tabindex="2"' . ($req ? 'aria-required="false"' : '') . ' class="form_control" /></div></div>'; return $fields; } add_filter('comment_form_default_fields', 'kadu_modify_comment_form_fields'); // comment Move Field function kadu_move_comment_field_to_bottom($fields) { $comment_field = $fields['comment']; unset($fields['comment']); $fields['comment'] = $comment_field; return $fields; } add_filter('comment_form_fields', 'kadu_move_comment_field_to_bottom'); /** * Product Per Page Count * * @param [type] $per_page * @return void */ /** * Authore Avater */ function kadu_main_author_avatars($size){ echo get_avatar(get_the_author_meta('email'), $size); } add_action('genesis_entry_header', 'kadu_post_author_avatars'); /** * pagination */ if (!function_exists('kadu_pagination')) { function _kadu_pagi_callback($pagination) { return $pagination; } //page navegation function kadu_pagination($prev, $next, $pages, $args) { global $wp_query, $wp_rewrite; $menu = ''; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; if ($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if (!$pages) { $pages = 1; } } $pagination = [ 'base' => add_query_arg('paged', '%#%'), 'format' => '', 'total' => $pages, 'current' => $current, 'prev_text' => $prev, 'next_text' => $next, 'type' => 'array', ]; //rewrite permalinks if ($wp_rewrite->using_permalinks()) { $pagination['base'] = user_trailingslashit(trailingslashit(remove_query_arg('s', get_pagenum_link(1))) . 'page/%#%/', 'paged'); } if (!empty($wp_query->query_vars['s'])) { $pagination['add_args'] = ['s' => get_query_var('s')]; } $pagi = ''; if (paginate_links($pagination) != '') { $paginations = paginate_links($pagination); $pagi .= '<ul class="feh-pagination">'; foreach ($paginations as $key => $pg) { $pagi .= '<li class="feh-pagination-item">' . $pg . '</li>'; } $pagi .= '<ul>'; } print _kadu_pagi_callback($pagi); } } /** * Search Widget */ function kadu_search_widgets($form) { $form = '<form role="search" method="get" id="searchform" class="sidebar-search" action="' . home_url('/') . '" > <input class="sidebar-search-input" placeholder="' . esc_attr__('Search...', 'kadu') . '" type="text" value="' . get_search_query() . '" name="s" id="s" /> <button type="submit" class="sidebar-search-btn"><i class="fa-solid fa-magnifying-glass"></i></button> </form>'; return $form; } add_filter('get_search_form', 'kadu_search_widgets', 100); /** * Authore */ function kadu_authore_info() { global $post; if (is_object($post)): $theme_author_markup = ''; // Get author's display name $display_name = get_the_author_meta('display_name', $post->post_author); // If display name is not available then use nickname as display name if (empty($display_name)) $display_name = get_the_author_meta('nickname', $post->post_author); // Get author's biographical information or description $user_description = get_the_author_meta('user_description', $post->post_author); $user_facebook = get_the_author_meta('facebook', $post->post_author); $user_twitter = get_the_author_meta('twitter', $post->post_author); $user_linkedin = get_the_author_meta('linkedin', $post->post_author); $user_instagram = get_the_author_meta('instagram', $post->post_author); $user_pinterest = get_the_author_meta('pinterest', $post->post_author); $user_youtube = get_the_author_meta('youtube', $post->post_author); // Get link to the author archive page $user_posts = get_author_posts_url(get_the_author_meta('ID', $post->post_author)); if (!empty($display_name)) // Author avatar - - the number 90 is the px size of the image. $theme_author_markup .= '<div class="img-wrap">' . get_avatar(get_the_author_meta('ID'), 140) . '</div>'; $theme_author_markup .= '<div class="inner-text headline pera-content">'; $theme_author_markup .= '<span class="name">' . $display_name . '</span>'; $theme_author_markup .= '<p class="comment-text">' . get_the_author_meta('description') . '</p>'; $theme_author_markup .= '<ul class="social-link">'; if (!empty($user_facebook)) { $theme_author_markup .= ' <li><a href="' . $user_facebook . '" target="_blank" rel="nofollow" class="fb_aut" title="Facebook"><i class="fab fa-facebook-f"></i> </a></li>'; } if (!empty($user_twitter)) { $theme_author_markup .= '<li> <a href="' . $user_twitter . '" target="_blank" rel="nofollow" class="twi_aut" title="Twitter"><i class="fab fa-twitter"></i> </a></li>'; } if (!empty($user_instagram)) { $theme_author_markup .= '<li> <a href="' . $user_instagram . '" target="_blank" rel="nofollow" class="inst_aut" title="Instagram"><i class="fab fa-instagram"></i> </a></li>'; } if (!empty($user_pinterest)) { $theme_author_markup .= '<li> <a href="' . $user_pinterest . '" target="_blank" rel="nofollow" class="pint_aut" title="Pinterest"><i class="fab fa-pinterest-p"></i> </a></li>'; } if (!empty($user_youtube)) { $theme_author_markup .= '<li> <a href="' . $user_youtube . '" target="_blank" rel="nofollow" class="you_aut" title="Youtube"><i class="fab fa-youtube"></i> </a>'; } if (!empty($user_linkedin)) { $theme_author_markup .= '<li> <a href="' . $user_linkedin . '" target="_blank" rel="nofollow" class="link_aut" title="linkedin"><i class="fab fa-linkedin-in"></i> </a></li>'; } $theme_author_markup .= '</ul>'; $theme_author_markup .= '</div>'; // Pass all this info to post content echo '<div class="blog-comment-item">' . $theme_author_markup . '</div>'; endif; } function kadu_wp_kses( $val ) { return wp_kses( $val, array( 'p' => array( 'class' => array(), 'style' => array(), ), 'img' => array( 'src' => array(), 'alt' => array(), 'class' => array(), 'style' => array(), ), 'span' => array( 'class' => array(), 'style' => array(), ), 'small' => array(), 'div' => array( 'style' => array(), ), 'strong' => array( 'style' => array(), ), 'b' => array( 'style' => array(), ), 'br' => array(), 'h1' => array( 'style' => array(), ), 'i' => array( 'class' => array(), 'style' => array(), ), 'ul' => array( 'class' => array(), 'style' => array(), ), 'ul' => array( 'id' => array(), ), 'li' => array( 'class' => array(), 'style' => array(), ), 'li' => array( 'id' => array(), ), 'h1' => array( 'style' => array(), ), 'h2' => array(), 'h3' => array( 'style' => array(), ), 'h4' => array( 'style' => array(), ), 'h5' => array( 'style' => array(), ), 'h6' => array( 'style' => array(), ), 'u' => array( 'style' => array(), ), 'a' => array( 'href' => array(), 'target' => array(), 'style' => array(), ), 'iframe' => array( 'src' => array(), 'height' => array(), 'width' => array() ), ), '' ); } /** * Product Per Page Count * * @param [type] $per_page * @return void */ function kadu_product_count( $cols ) { $product_count = cs_get_option('product_count'); $cols = !empty($product_count) ? $product_count : '12'; return $cols; } add_filter( 'loop_shop_per_page', 'kadu_product_count', 20 ); /** * kadu Single Post Nav */ function kadu_single_post_pagination(){ $kadu_prev_post = get_previous_post(); $kadu_next_post = get_next_post(); ?> <div class="blog-post-next-btn"> <a class="next-prv-btn" href="<?php echo esc_url(get_the_permalink($kadu_prev_post));?>"><i class="fal fa-long-arrow-left"></i> <?php esc_html_e('previous post', 'kadu');?></a> <a class="next-prv-btn" href="<?php echo esc_url(get_the_permalink($kadu_next_post));?>"><?php esc_html_e('next post', 'kadu');?> <i class="fal fa-long-arrow-right"></i></a> </div> <?php }