Sid Gifari File Manager
🏠 Root
/
home
/
ailwtbdh
/
lynchestinegroup.com
/
wp-content
/
themes
/
koncrete
/
inc
/
Editing: helper.php
<?php /** * @author RadiusTheme * @since 1.0 * @version 1.0 */ namespace radiustheme\Koncrete; use \WP_Query; use radiustheme\Koncrete\RDTheme; class Helper { use IconTrait; use ImageTrait; use ResourceLoadTrait; use LayoutTrait; use CustomQueryTrait; use ImpureTrait; use UtilityTrait; use DataTrait; use WooTrait; public static function get_template_part( $template, $args = array() ){ extract( $args ); $template = '/' . $template . '.php'; if ( file_exists( get_stylesheet_directory() . $template ) ) { $file = get_stylesheet_directory() . $template; } else { $file = get_template_directory() . $template; } require $file; } public static function comments_callback( $comment, $args, $depth ){ $args2 = get_defined_vars(); self::get_template_part( 'template-parts/comments-callback', $args2 ); } public static function the_breadcrumb() { if ( function_exists( 'bcn_display') ) { bcn_display(); } else { self::requires( 'breadcrumbs.php' ); $args = array( 'show_browse' => false, 'post_taxonomy' => array( "koncrete_team" => "koncrete_team_category", "koncrete_project" => "koncrete_project_category", "koncrete_service" => "koncrete_service_category", ) ); $breadcrumb = new RDTheme_Breadcrumb( $args ); return $breadcrumb->trail(); } } public static function the_title() { if ( is_404() ) { $title = esc_html__( 'Page not Found', 'koncrete' ); } elseif ( is_search() ) { $title = esc_html__( 'Search Results for : ', 'koncrete' ) . get_search_query(); } elseif ( is_home() ) { if ( get_option( 'page_for_posts' ) ) { $title = get_the_title( get_option( 'page_for_posts' ) ); } else { $title = apply_filters( "rdtheme_blog_title", esc_html__( 'All Posts', 'koncrete' ) ); } } elseif ( is_archive() ) { $title = get_the_archive_title(); } elseif ( is_page() ) { $title = get_the_title(); } else{ $title = get_the_title(); } echo wp_kses_post( $title ); } public static function filter_content( $content ){ // wp filters $content = wptexturize( $content ); $content = convert_smilies( $content ); $content = convert_chars( $content ); $content = wpautop( $content ); $content = shortcode_unautop( $content ); // remove shortcodes $pattern= '/\[(.+?)\]/'; $content = preg_replace( $pattern,'',$content ); // remove tags $content = strip_tags( $content ); return $content; } public static function get_current_post_content( $post = false ) { if ( !$post ) { $post = get_post(); } $content = has_excerpt( $post->ID ) ? $post->post_excerpt : $post->post_content; $content = self::filter_content( $content ); return $content; } public static function socials(){ $rdtheme_socials = array( 'social_facebook' => array( 'icon' => 'fa fa-facebook-f', 'url' => RDTheme::$options['social_facebook'], ), 'social_twitter' => array( 'icon' => 'fa fa-twitter', 'url' => RDTheme::$options['social_twitter'], ), 'social_gplus' => array( 'icon' => 'fa fa-google-plus', 'url' => RDTheme::$options['social_gplus'], ), 'social_linkedin' => array( 'icon' => 'fa fa-linkedin', 'url' => RDTheme::$options['social_linkedin'], ), 'social_youtube' => array( 'icon' => 'fa fa-youtube', 'url' => RDTheme::$options['social_youtube'], ), 'social_pinterest' => array( 'icon' => 'fa fa-pinterest', 'url' => RDTheme::$options['social_pinterest'], ), 'social_instagram' => array( 'icon' => 'fa fa-instagram', 'url' => RDTheme::$options['social_instagram'], ), 'social_skype' => array( 'icon' => 'fa fa-skype', 'url' => RDTheme::$options['social_skype'], ), 'social_rss' => array( 'icon' => 'fa fa-rss', 'url' => RDTheme::$options['social_rss'], ), ); return array_filter( $rdtheme_socials, array( __CLASS__ , 'filter_social' ) ); } public static function team_socials(){ $team_socials = array( 'facebook' => array( 'label' => __( 'Facebook', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-facebook', ), 'twitter' => array( 'label' => __( 'Twitter', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-twitter', ), 'linkedin' => array( 'label' => __( 'Linkedin', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-linkedin', ), 'youtube' => array( 'label' => __( 'Youtube', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-youtube-play', ), 'pinterest' => array( 'label' => __( 'Pinterest', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-pinterest-p', ), 'instagram' => array( 'label' => __( 'Instagram', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-instagram', ), 'github' => array( 'label' => __( 'Github', 'koncrete' ), 'type' => 'text', 'icon' => 'fa-github', ), ); return apply_filters( 'team_socials', $team_socials ); } public static function filter_social( $args ){ return ( $args['url'] != '' ); } public static function top_bar_contacts1() { $top_bar_contacts_for_common_layout = array( 'phone' => array( 'icon' => 'flaticon-phone-call', 'text' => RDTheme::$options['phone'], ), 'office_time' => array( 'icon' => 'flaticon-clock', 'text' => RDTheme::$options['office_time'], ), ); return array_filter( $top_bar_contacts_for_common_layout, array( __CLASS__ , 'filter_top_bar_contacts' ) ); } public static function top_bar_contacts3() { $top_bar_contacts_for_common_layout = array( 'phone' => array( 'icon' => 'flaticon-phone-call', 'text' => RDTheme::$options['phone'], ), 'email' => array( 'icon' => 'flaticon-message', 'text' => RDTheme::$options['email'], ), 'office_time' => array( 'icon' => 'flaticon-clock', 'text' => RDTheme::$options['office_time'], ), ); return array_filter( $top_bar_contacts_for_common_layout, array( __CLASS__ , 'filter_top_bar_contacts' ) ); } public static function filter_top_bar_contacts($args) { return ( $args['text'] != '' ); } /** * main topbar args query */ public static function nav_menu_args(){ $pagemenu = false; if ( ( is_single() || is_page() ) ) { $menuid = RDTheme::$page_menu; if ( !empty( $menuid ) && $menuid != 'default' ) { $pagemenu = $menuid; } } $common_args = array( 'container' => 'nav', ); if ( $pagemenu ) { $nav_menu_args = array( 'menu' => $pagemenu); } else { $nav_menu_args = array( 'theme_location' => 'primary'); } $nav_menu_args = array_merge($nav_menu_args, $common_args); return $nav_menu_args; } public static function custom_sidebar_fields() { $prefix = Constants::$theme_prefix; $sidebar_fields = array(); $sidebar_fields['sidebar'] = __( 'Sidebar', 'koncrete' ); $sidebars = get_option( "{$prefix}_custom_sidebars", array() ); if ( $sidebars ) { foreach ( $sidebars as $sidebar ) { $sidebar_fields[$sidebar['id']] = $sidebar['name']; } } return $sidebar_fields; } public static function koncrete_post_date($date_string) { $time = strtotime( $date_string ); return date( 'F j, Y', $time ); } public static function generate_excerpt($post, $length = 55, $dot = false) { // no work for if block if (has_excerpt($post)) { $final_content = wp_trim_words( get_the_excerpt($post), $length, ''); } else { $post = get_post($post); $content = wp_strip_all_tags($post->post_content); $final_content = wp_trim_words( $content, $length, '' ); } if ($dot) { $final_content = "$final_content $dot"; } return $final_content; } }
Save
Cancel