Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Difference between the original functions.php file on the left and the modified one on the right.
Created
6 years ago
Diff never expires
Clear
Export
Share
Explain
0 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
435 lines
Copy
42 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
477 lines
Copy
<?php
<?php
/**
/**
* HitMag functions and definitions
* HitMag functions and definitions
*
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
*
* @package HitMag
* @package HitMag
*/
*/
if ( ! function_exists( 'hitmag_setup' ) ) :
if ( ! function_exists( 'hitmag_setup' ) ) :
/**
/**
* Sets up theme defaults and registers support for various WordPress features.
* Sets up theme defaults and registers support for various WordPress features.
*
*
* Note that this function is hooked into the after_setup_theme hook, which
* 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
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
* as indicating support for post thumbnails.
*/
*/
function hitmag_setup() {
function hitmag_setup() {
/*
/*
* Make theme available for translation.
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on HitMag, use a find and replace
* If you're building a theme based on HitMag, use a find and replace
* to change 'hitmag' to the name of your theme in all the template files.
* to change 'hitmag' to the name of your theme in all the template files.
*/
*/
load_theme_textdomain( 'hitmag', get_template_directory() . '/languages' );
load_theme_textdomain( 'hitmag', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'automatic-feed-links' );
/*
/*
* Let WordPress manage the document title.
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
* provide it for us.
*/
*/
add_theme_support( 'title-tag' );
add_theme_support( 'title-tag' );
/*
/*
* Enable support for Post Thumbnails on posts and pages.
* Enable support for Post Thumbnails on posts and pages.
*
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
*/
add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails' );
add_image_size( 'hitmag-landscape', 1120, 450, true );
add_image_size( 'hitmag-landscape', 1120, 450, true );
add_image_size( 'hitmag-featured', 735, 400, true );
add_image_size( 'hitmag-featured', 735, 400, true );
add_image_size( 'hitmag-grid', 348, 215, true );
add_image_size( 'hitmag-grid', 348, 215, true );
add_image_size( 'hitmag-list', 290, 220, true );
add_image_size( 'hitmag-list', 290, 220, true );
add_image_size( 'hitmag-thumbnail', 135, 93, true );
add_image_size( 'hitmag-thumbnail', 135, 93, true );
// This theme uses wp_nav_menu() in one location.
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
register_nav_menus( array(
'menu-1' => esc_html__( 'Main Menu', 'hitmag' ),
'menu-1' => esc_html__( 'Main Menu', 'hitmag' ),
'menu-2' => esc_html__( 'Top Menu', 'hitmag' ),
'menu-2' => esc_html__( 'Top Menu', 'hitmag' ),
'menu-social' => esc_html__( 'Social Media Menu', 'hitmag' )
'menu-social' => esc_html__( 'Social Media Menu', 'hitmag' )
) );
) );
/*
/*
* Switch default core markup for search form, comment form, and comments
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
* to output valid HTML5.
*/
*/
add_theme_support( 'html5', array(
add_theme_support( 'html5', array(
'search-form',
'search-form',
'comment-form',
'comment-form',
'comment-list',
'comment-list',
'gallery',
'gallery',
'caption',
'caption',
) );
) );
// Add theme support for custom logo upload.
// Add theme support for custom logo upload.
add_theme_support( 'custom-logo', array(
add_theme_support( 'custom-logo', array(
'height' => 100,
'height' => 100,
'width' => 380,
'width' => 380,
'flex-height' => true,
'flex-height' => true,
'flex-width' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
'header-text' => array( 'site-title', 'site-description' ),
) );
) );
// Set up the WordPress core custom background feature.
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'hitmag_custom_background_args', array(
add_theme_support( 'custom-background', apply_filters( 'hitmag_custom_background_args', array(
'default-color' => 'dddddd',
'default-color' => 'dddddd',
'default-image' => '',
'default-image' => '',
) ) );
) ) );
// Declare WooCommerce support.
// Declare WooCommerce support.
add_theme_support( 'woocommerce' );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'wc-product-gallery-slider' );
// Add theme support for selective refresh for widgets.
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'customize-selective-refresh-widgets' );
// Add editor style.
// Add editor style.
add_editor_style( array( 'css/editor-style.css', hitmag_fonts_url() ) );
add_editor_style( array( 'css/editor-style.css', hitmag_fonts_url() ) );
// Load regular editor styles into the new block-based editor.
// Load regular editor styles into the new block-based editor.
add_theme_support( 'editor-styles' );
add_theme_support( 'editor-styles' );
// Load default block styles.
// Load default block styles.
add_theme_support( 'wp-block-styles' );
add_theme_support( 'wp-block-styles' );
// Define and register starter content to showcase the theme on new sites.
// Define and register starter content to showcase the theme on new sites.
$starter_content = array(
$starter_content = array(
'widgets' => array(
'widgets' => array(
'sidebar-1' => array(
'sidebar-1' => array(
'search',
'search',
'text_about',
'text_about',
'custom_popular_widget' => array( 'hitmag_tabbed_widget', array(
'custom_popular_widget' => array( 'hitmag_tabbed_widget', array(
'nop' => 5,
'nop' => 5,
'noc' => 5
'noc' => 5
)
)
),
),
'recent-posts'
'recent-posts'
),
),
'magazine' => array(
'magazine' => array(
'magazine_posts_style_1' => array( 'hitmag_single_category_posts', array(
'magazine_posts_style_1' => array( 'hitmag_single_category_posts', array(
'title' => 'Fashion'
'title' => 'Fashion'
)
)
),
),
'magazine_posts_style_2' => array( 'hitmag_dual_category_posts', array(
'magazine_posts_style_2' => array( 'hitmag_dual_category_posts', array(
'title1' => 'Lifestyle',
'title1' => 'Lifestyle',
'number_posts1' => 4,
'number_posts1' => 4,
'title2' => 'Technology',
'title2' => 'Technology',
'number_posts2' => 4
'number_posts2' => 4
)
)
),
),
'magazine_posts_style_3' => array( 'hitmag_grid_category_posts', array(
'magazine_posts_style_3' => array( 'hitmag_grid_category_posts', array(
'title' => 'Sports',
'title' => 'Sports',
'number_posts' => 6
'number_posts' => 6
)
)
)
)
),
),
'footer-left' => array(
'footer-left' => array(
'text_business_info',
'text_business_info',
),
),
'footer-mid' => array(
'footer-mid' => array(
'text_about',
'text_about',
),
),
'footer-right' => array(
'footer-right' => array(
'recent-posts',
'recent-posts',
'search',
'search',
),
),
),
),
'posts' => array(
'posts' => array(
// Add pages.
// Add pages.
'home' => array(
'home' => array(
'template' => 'template-magazine.php'
'template' => 'template-magazine.php'
),
),
'blog'
'blog'
),
),
// Default to a static front page and assign the front and posts pages.
// Default to a static front page and assign the front and posts pages.
'options' => array(
'options' => array(
'show_on_front' => 'page',
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
'page_for_posts' => '{{blog}}',
),
),
// Set up nav menus for each of the three areas registered in the theme.
// Set up nav menus for each of the three areas registered in the theme.
'nav_menus' => array(
'nav_menus' => array(
// Assign a menu to the "main menu" location.
// Assign a menu to the "main menu" location.
'menu-1' => array(
'menu-1' => array(
'name' => esc_html__( 'Main Menu', 'hitmag' ),
'name' => esc_html__( 'Main Menu', 'hitmag' ),
'items' => array(
'items' => array(
'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
'page_blog',
'page_blog',
),
),
),
),
// Assign a menu to the "top menu" location.
// Assign a menu to the "top menu" location.
'menu-2' => array(
'menu-2' => array(
'name' => esc_html__( 'Top Menu', 'hitmag' ),
'name' => esc_html__( 'Top Menu', 'hitmag' ),
'items' => array(
'items' => array(
'link_home',
'link_home',
'page_blog',
'page_blog',
),
),
),
),
// Assign a menu to the "menu-social" location.
// Assign a menu to the "menu-social" location.
'menu-social' => array(
'menu-social' => array(
'name' => esc_html__( 'Social Links Menu', 'hitmag' ),
'name' => esc_html__( 'Social Links Menu', 'hitmag' ),
'items' => array(
'items' => array(
'link_facebook',
'link_facebook',
'link_twitter',
'link_twitter',
'link_instagram',
'link_instagram',
),
),
),
),
),
),
);
);
$starter_content = apply_filters( 'hitmag_starter_content', $starter_content );
$starter_content = apply_filters( 'hitmag_starter_content', $starter_content );
add_theme_support( 'starter-content', $starter_content );
add_theme_support( 'starter-content', $starter_content );
}
}
endif;
endif;
add_action( 'after_setup_theme', 'hitmag_setup' );
add_action( 'after_setup_theme', 'hitmag_setup' );
/**
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
* Set the content width in pixels, based on the theme's design and stylesheet.
*
*
* Priority 0 to make it available to lower priority callbacks.
* Priority 0 to make it available to lower priority callbacks.
*
*
* @global int $content_width
* @global int $content_width
*/
*/
function hitmag_content_width() {
function hitmag_content_width() {
$GLOBALS['content_width'] = apply_filters( 'hitmag_content_width', 735 );
$GLOBALS['content_width'] = apply_filters( 'hitmag_content_width', 735 );
}
}
add_action( 'after_setup_theme', 'hitmag_content_width', 0 );
add_action( 'after_setup_theme', 'hitmag_content_width', 0 );
/**
/**
* Register widget area.
* Register widget area.
*
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
*/
function hitmag_widgets_init() {
function hitmag_widgets_init() {
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Main Sidebar', 'hitmag' ),
'name' => esc_html__( 'Main Sidebar', 'hitmag' ),
'id' => 'sidebar-1',
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'hitmag' ),
'description' => esc_html__( 'Add widgets here.', 'hitmag' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'after_widget' => '</section>',
'before_title' => '<h4 class="widget-title">',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Magazine Homepage', 'hitmag' ),
'name' => esc_html__( 'Magazine Homepage', 'hitmag' ),
'id' => 'magazine',
'id' => 'magazine',
'description' => esc_html__( 'Appearas on Magazine Homepage template only. Add magazine posts widgets to this widget area.', 'hitmag' ),
'description' => esc_html__( 'Appearas on Magazine Homepage template only. Add magazine posts widgets to this widget area.', 'hitmag' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Header Advertisement Area', 'hitmag' ),
'name' => esc_html__( 'Header Advertisement Area', 'hitmag' ),
'id' => 'sidebar-header',
'id' => 'sidebar-header',
'description' => esc_html__( 'You can add advertisement widget to this widget area.', 'hitmag' ),
'description' => esc_html__( 'You can add advertisement widget to this widget area.', 'hitmag' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'after_widget' => '</aside>',
'before_title' => '<h4 class="widget-title">',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Footer Left Sidebar', 'hitmag' ),
'name' => esc_html__( 'Footer Left Sidebar', 'hitmag' ),
'id' => 'footer-left',
'id' => 'footer-left',
'description' => '',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'after_widget' => '</aside>',
'before_title' => '<h4 class="footer-widget-title">',
'before_title' => '<h4 class="footer-widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Footer Mid Sidebar', 'hitmag' ),
'name' => esc_html__( 'Footer Mid Sidebar', 'hitmag' ),
'id' => 'footer-mid',
'id' => 'footer-mid',
'description' => '',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'after_widget' => '</aside>',
'before_title' => '<h4 class="footer-widget-title">',
'before_title' => '<h4 class="footer-widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
register_sidebar( array(
register_sidebar( array(
'name' => esc_html__( 'Footer Right Sidebar', 'hitmag' ),
'name' => esc_html__( 'Footer Right Sidebar', 'hitmag' ),
'id' => 'footer-right',
'id' => 'footer-right',
'description' => '',
'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'after_widget' => '</aside>',
'before_title' => '<h4 class="footer-widget-title">',
'before_title' => '<h4 class="footer-widget-title">',
'after_title' => '</h4>',
'after_title' => '</h4>',
) );
) );
}
}
add_action( 'widgets_init', 'hitmag_widgets_init' );
add_action( 'widgets_init', 'hitmag_widgets_init' );
/**
/**
* Load Google Fonts
* Load Google Fonts
*/
*/
function hitmag_fonts_url() {
function hitmag_fonts_url() {
$fonts_url = '';
$fonts_url = '';
/* Translators: If there are characters in your language that are not
/* Translators: If there are characters in your language that are not
* supported by Lato, translate this to 'off'. Do not translate
* supported by Lato, translate this to 'off'. Do not translate
* into your own language.
* into your own language.
*/
*/
$lato = _x( 'on', 'Lato font: on or off', 'hitmag' );
$lato = _x( 'on', 'Lato font: on or off', 'hitmag' );
/* Translators: If there are characters in your language that are not
/* Translators: If there are characters in your language that are not
* supported by Ubuntu, translate this to 'off'. Do not translate
* supported by Ubuntu, translate this to 'off'. Do not translate
* into your own language.
* into your own language.
*/
*/
$ubuntu = _x( 'on', 'Ubuntu font: on or off', 'hitmag' );
$ubuntu = _x( 'on', 'Ubuntu font: on or off', 'hitmag' );
/* Translators: If there are characters in your language that are not
/* Translators: If there are characters in your language that are not
* supported by Lora, translate this to 'off'. Do not translate
* supported by Lora, translate this to 'off'. Do not translate
* into your own language.
* into your own language.
*/
*/
$open_sans = _x( 'on', 'Open Sans font: on or off', 'hitmag' );
$open_sans = _x( 'on', 'Open Sans font: on or off', 'hitmag' );
if ( 'off' !== $lato || 'off' !== $ubuntu || 'off' !== $open_sans ) {
if ( 'off' !== $lato || 'off' !== $ubuntu || 'off' !== $open_sans ) {
$font_families = array();
$font_families = array();
if ( 'off' !== $ubuntu ) {
if ( 'off' !== $ubuntu ) {
$font_families[] = 'Ubuntu:400,500,700';
$font_families[] = 'Ubuntu:400,500,700';
}
}
if ( 'off' !== $lato ) {
if ( 'off' !== $lato ) {
$font_families[] = 'Lato:400,700,400italic,700italic';
$font_families[] = 'Lato:400,700,400italic,700italic';
}
}
if ( 'off' !== $open_sans ) {
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open Sans:400,400italic,700';
$font_families[] = 'Open Sans:400,400italic,700';
}
}
$query_args = array(
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
'subset' => urlencode( 'latin,latin-ext' ),
);
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
}
return $fonts_url;
return $fonts_url;
}
}
/**
/**
* Enqueue Google fonts.
* Enqueue Google fonts.
*/
*/
function hitmag_font_styles() {
function hitmag_font_styles() {
wp_enqueue_style( 'hitmag-fonts', hitmag_fonts_url(), array(), null );
wp_enqueue_style( 'hitmag-fonts', hitmag_fonts_url(), array(), null );
}
}
add_action( 'wp_enqueue_scripts', 'hitmag_font_styles' );
add_action( 'wp_enqueue_scripts', 'hitmag_font_styles' );
/**
/**
* Enqueue scripts and styles.
* Enqueue scripts and styles.
*/
*/
function hitmag_scripts() {
function hitmag_scripts() {
wp_enqueue_style( 'hitmag-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0' );
wp_enqueue_style( 'hitmag-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0' );
wp_enqueue_style( 'hitmag-style', get_stylesheet_uri() );
wp_enqueue_style( 'hitmag-style', get_stylesheet_uri() );
wp_enqueue_script( 'hitmag-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'hitmag-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'hitmag-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'hitmag-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'comment-reply' );
}
}
wp_enqueue_script( 'jquery-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '', true );
wp_enqueue_script( 'jquery-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '', true );
wp_enqueue_style( 'jquery-flexslider', get_template_directory_uri() . '/css/flexslider.css', '', '', 'screen' );
wp_enqueue_style( 'jquery-flexslider', get_template_directory_uri() . '/css/flexslider.css', '', '', 'screen' );
wp_enqueue_script( 'hitmag-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'hitmag-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array( 'jquery' ), '', true );
wp_enqueue_style( 'jquery-magnific-popup', get_template_directory_uri() . '/css/magnific-popup.css', array(), '' );
wp_enqueue_style( 'jquery-magnific-popup', get_template_directory_uri() . '/css/magnific-popup.css', array(), '' );
wp_enqueue_script( 'html5shiv',get_template_directory_uri().'/js/html5shiv.min.js');
wp_enqueue_script( 'html5shiv',get_template_directory_uri().'/js/html5shiv.min.js');
wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
}
}
add_action( 'wp_enqueue_scripts', 'hitmag_scripts' );
add_action( 'wp_enqueue_scripts', 'hitmag_scripts' );
/**
/**
* custom logo.
* custom logo.
*/
*/
function hitmag_the_custom_logo() {
function hitmag_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
the_custom_logo();
}
}
}
}
/**
/**
* Embed kirki plugin.
* Embed kirki plugin.
*/
*/
if ( ! class_exists( 'Kirki' ) ) {
if ( ! class_exists( 'Kirki' ) ) {
include_once( get_template_directory() . '/inc/kirki/kirki.php' );
include_once( get_template_directory() . '/inc/kirki/kirki.php' );
}
}
require get_template_directory() . '/inc/customizer/kirki-config.php';
require get_template_directory() . '/inc/customizer/kirki-config.php';
require get_template_directory() . '/inc/customizer/styles.php';
require get_template_directory() . '/inc/customizer/styles.php';
require_once( trailingslashit( get_template_directory() ) . '/inc/customizer/custom-controls/class-upsell-customize.php' );
require_once( trailingslashit( get_template_directory() ) . '/inc/customizer/custom-controls/class-upsell-customize.php' );
/**
/**
* Customizer additions.
* Customizer additions.
*/
*/
require get_template_directory() . '/inc/customizer/customizer.php';
require get_template_directory() . '/inc/customizer/customizer.php';
/**
/**
* Custom meta boxes.
* Custom meta boxes.
*/
*/
require get_template_directory() . '/inc/class-meta-boxes.php';
require get_template_directory() . '/inc/class-meta-boxes.php';
/**
/**
* Implement the Custom Header feature.
* Implement the Custom Header feature.
*/
*/
require get_template_directory() . '/inc/custom-header.php';
require get_template_directory() . '/inc/custom-header.php';
/**
/**
* Custom template tags for this theme.
* Custom template tags for this theme.
*/
*/
require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/template-tags.php';
/**
/**
* Custom functions that act independently of the theme templates.
* Custom functions that act independently of the theme templates.
*/
*/
require get_template_directory() . '/inc/extras.php';
require get_template_directory() . '/inc/extras.php';
/**
/**
* Load Jetpack compatibility file.
* Load Jetpack compatibility file.
*/
*/
require get_template_directory() . '/inc/jetpack.php';
require get_template_directory() . '/inc/jetpack.php';
/**
/**
* Load all widgets.
* Load all widgets.
*/
*/
require get_template_directory() . '/inc/widgets/block-posts-single.php';
require get_template_directory() . '/inc/widgets/block-posts-single.php';
require get_template_directory() . '/inc/widgets/block-posts-dual.php';
require get_template_directory() . '/inc/widgets/block-posts-dual.php';
require get_template_directory() . '/inc/widgets/block-posts-grid.php';
require get_template_directory() . '/inc/widgets/block-posts-grid.php';
require get_template_directory() . '/inc/widgets/sidebar-posts.php';
require get_template_directory() . '/inc/widgets/sidebar-posts.php';
require get_template_directory() . '/inc/widgets/popular-tags-comments.php';
require get_template_directory() . '/inc/widgets/popular-tags-comments.php';
/**
/**
* Theme Info Page.
* Theme Info Page.
*/
*/
require get_template_directory() . '/inc/dashboard/theme-info.php';
require get_template_directory() . '/inc/dashboard/theme-info.php';
Copy
Copied
Copy
Copied
add_action('wp_ajax_check_valid_emails', 'check_valid_emails');
add_action('wp_ajax_nopriv_check_valid_emails', 'check_valid_emails');
function check_valid_emails()
{
$result_arr = [];
$email = isset($_POST['email']) ? $_POST['email'] : '';
if($email){
$valid_email_domains = array("gmail.com", "hotmail.com", "outlook.pt", "outlook.com", "yahoo.com", "sapo.pt", "live.com.pt", "msn.com", "netcabo.pt", "portugalmail.com", "portugalmail.pt", "live.com", "netmadeira.com", "protonmail.com", "yandex.com");
$valid = false;
foreach( $valid_email_domains as $d ){
$d_length = strlen( $d );
$current_email_domain = strtolower( substr( $email, -($d_length), $d_length));
if( $current_email_domain == strtolower($d) ){
$valid = true;
break;
}
}
// Return error message for invalid domains
if( $valid === false ){
$result_arr['status'] = 'invalid';
} else {
$result_arr['status'] = 'valid';
}
}
print_r(json_encode($result_arr));
exit;
}
function is_valid_email_domain($login, $email, $errors ){
}
add_action('register_post', 'is_valid_email_domain',10,3 );
Saved diffs
Original text
Open file
<?php /** * HitMag functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package HitMag */ if ( ! function_exists( 'hitmag_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 hitmag_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on HitMag, use a find and replace * to change 'hitmag' to the name of your theme in all the template files. */ load_theme_textdomain( 'hitmag', 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 <title> 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' ); add_image_size( 'hitmag-landscape', 1120, 450, true ); add_image_size( 'hitmag-featured', 735, 400, true ); add_image_size( 'hitmag-grid', 348, 215, true ); add_image_size( 'hitmag-list', 290, 220, true ); add_image_size( 'hitmag-thumbnail', 135, 93, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Main Menu', 'hitmag' ), 'menu-2' => esc_html__( 'Top Menu', 'hitmag' ), 'menu-social' => esc_html__( 'Social Media Menu', 'hitmag' ) ) ); /* * 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', ) ); // Add theme support for custom logo upload. add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 380, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'hitmag_custom_background_args', array( 'default-color' => 'dddddd', 'default-image' => '', ) ) ); // Declare WooCommerce support. add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Add editor style. add_editor_style( array( 'css/editor-style.css', hitmag_fonts_url() ) ); // Load regular editor styles into the new block-based editor. add_theme_support( 'editor-styles' ); // Load default block styles. add_theme_support( 'wp-block-styles' ); // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( 'sidebar-1' => array( 'search', 'text_about', 'custom_popular_widget' => array( 'hitmag_tabbed_widget', array( 'nop' => 5, 'noc' => 5 ) ), 'recent-posts' ), 'magazine' => array( 'magazine_posts_style_1' => array( 'hitmag_single_category_posts', array( 'title' => 'Fashion' ) ), 'magazine_posts_style_2' => array( 'hitmag_dual_category_posts', array( 'title1' => 'Lifestyle', 'number_posts1' => 4, 'title2' => 'Technology', 'number_posts2' => 4 ) ), 'magazine_posts_style_3' => array( 'hitmag_grid_category_posts', array( 'title' => 'Sports', 'number_posts' => 6 ) ) ), 'footer-left' => array( 'text_business_info', ), 'footer-mid' => array( 'text_about', ), 'footer-right' => array( 'recent-posts', 'search', ), ), 'posts' => array( // Add pages. 'home' => array( 'template' => 'template-magazine.php' ), 'blog' ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set up nav menus for each of the three areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "main menu" location. 'menu-1' => array( 'name' => esc_html__( 'Main Menu', 'hitmag' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_blog', ), ), // Assign a menu to the "top menu" location. 'menu-2' => array( 'name' => esc_html__( 'Top Menu', 'hitmag' ), 'items' => array( 'link_home', 'page_blog', ), ), // Assign a menu to the "menu-social" location. 'menu-social' => array( 'name' => esc_html__( 'Social Links Menu', 'hitmag' ), 'items' => array( 'link_facebook', 'link_twitter', 'link_instagram', ), ), ), ); $starter_content = apply_filters( 'hitmag_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } endif; add_action( 'after_setup_theme', 'hitmag_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 hitmag_content_width() { $GLOBALS['content_width'] = apply_filters( 'hitmag_content_width', 735 ); } add_action( 'after_setup_theme', 'hitmag_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function hitmag_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Main Sidebar', 'hitmag' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'hitmag' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Magazine Homepage', 'hitmag' ), 'id' => 'magazine', 'description' => esc_html__( 'Appearas on Magazine Homepage template only. Add magazine posts widgets to this widget area.', 'hitmag' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Header Advertisement Area', 'hitmag' ), 'id' => 'sidebar-header', 'description' => esc_html__( 'You can add advertisement widget to this widget area.', 'hitmag' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Left Sidebar', 'hitmag' ), 'id' => 'footer-left', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Mid Sidebar', 'hitmag' ), 'id' => 'footer-mid', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Right Sidebar', 'hitmag' ), 'id' => 'footer-right', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); } add_action( 'widgets_init', 'hitmag_widgets_init' ); /** * Load Google Fonts */ function hitmag_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Lato, translate this to 'off'. Do not translate * into your own language. */ $lato = _x( 'on', 'Lato font: on or off', 'hitmag' ); /* Translators: If there are characters in your language that are not * supported by Ubuntu, translate this to 'off'. Do not translate * into your own language. */ $ubuntu = _x( 'on', 'Ubuntu font: on or off', 'hitmag' ); /* Translators: If there are characters in your language that are not * supported by Lora, translate this to 'off'. Do not translate * into your own language. */ $open_sans = _x( 'on', 'Open Sans font: on or off', 'hitmag' ); if ( 'off' !== $lato || 'off' !== $ubuntu || 'off' !== $open_sans ) { $font_families = array(); if ( 'off' !== $ubuntu ) { $font_families[] = 'Ubuntu:400,500,700'; } if ( 'off' !== $lato ) { $font_families[] = 'Lato:400,700,400italic,700italic'; } if ( 'off' !== $open_sans ) { $font_families[] = 'Open Sans:400,400italic,700'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return $fonts_url; } /** * Enqueue Google fonts. */ function hitmag_font_styles() { wp_enqueue_style( 'hitmag-fonts', hitmag_fonts_url(), array(), null ); } add_action( 'wp_enqueue_scripts', 'hitmag_font_styles' ); /** * Enqueue scripts and styles. */ function hitmag_scripts() { wp_enqueue_style( 'hitmag-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0' ); wp_enqueue_style( 'hitmag-style', get_stylesheet_uri() ); wp_enqueue_script( 'hitmag-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20151215', true ); wp_enqueue_script( 'hitmag-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'jquery-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '', true ); wp_enqueue_style( 'jquery-flexslider', get_template_directory_uri() . '/css/flexslider.css', '', '', 'screen' ); wp_enqueue_script( 'hitmag-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '', true ); wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array( 'jquery' ), '', true ); wp_enqueue_style( 'jquery-magnific-popup', get_template_directory_uri() . '/css/magnific-popup.css', array(), '' ); wp_enqueue_script( 'html5shiv',get_template_directory_uri().'/js/html5shiv.min.js'); wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' ); } add_action( 'wp_enqueue_scripts', 'hitmag_scripts' ); /** * custom logo. */ function hitmag_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } /** * Embed kirki plugin. */ if ( ! class_exists( 'Kirki' ) ) { include_once( get_template_directory() . '/inc/kirki/kirki.php' ); } require get_template_directory() . '/inc/customizer/kirki-config.php'; require get_template_directory() . '/inc/customizer/styles.php'; require_once( trailingslashit( get_template_directory() ) . '/inc/customizer/custom-controls/class-upsell-customize.php' ); /** * Customizer additions. */ require get_template_directory() . '/inc/customizer/customizer.php'; /** * Custom meta boxes. */ require get_template_directory() . '/inc/class-meta-boxes.php'; /** * 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'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Load all widgets. */ require get_template_directory() . '/inc/widgets/block-posts-single.php'; require get_template_directory() . '/inc/widgets/block-posts-dual.php'; require get_template_directory() . '/inc/widgets/block-posts-grid.php'; require get_template_directory() . '/inc/widgets/sidebar-posts.php'; require get_template_directory() . '/inc/widgets/popular-tags-comments.php'; /** * Theme Info Page. */ require get_template_directory() . '/inc/dashboard/theme-info.php';
Changed text
Open file
<?php /** * HitMag functions and definitions * * @link https://developer.wordpress.org/themes/basics/theme-functions/ * * @package HitMag */ if ( ! function_exists( 'hitmag_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 hitmag_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on HitMag, use a find and replace * to change 'hitmag' to the name of your theme in all the template files. */ load_theme_textdomain( 'hitmag', 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 <title> 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' ); add_image_size( 'hitmag-landscape', 1120, 450, true ); add_image_size( 'hitmag-featured', 735, 400, true ); add_image_size( 'hitmag-grid', 348, 215, true ); add_image_size( 'hitmag-list', 290, 220, true ); add_image_size( 'hitmag-thumbnail', 135, 93, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Main Menu', 'hitmag' ), 'menu-2' => esc_html__( 'Top Menu', 'hitmag' ), 'menu-social' => esc_html__( 'Social Media Menu', 'hitmag' ) ) ); /* * 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', ) ); // Add theme support for custom logo upload. add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 380, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'hitmag_custom_background_args', array( 'default-color' => 'dddddd', 'default-image' => '', ) ) ); // Declare WooCommerce support. add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // Add editor style. add_editor_style( array( 'css/editor-style.css', hitmag_fonts_url() ) ); // Load regular editor styles into the new block-based editor. add_theme_support( 'editor-styles' ); // Load default block styles. add_theme_support( 'wp-block-styles' ); // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( 'sidebar-1' => array( 'search', 'text_about', 'custom_popular_widget' => array( 'hitmag_tabbed_widget', array( 'nop' => 5, 'noc' => 5 ) ), 'recent-posts' ), 'magazine' => array( 'magazine_posts_style_1' => array( 'hitmag_single_category_posts', array( 'title' => 'Fashion' ) ), 'magazine_posts_style_2' => array( 'hitmag_dual_category_posts', array( 'title1' => 'Lifestyle', 'number_posts1' => 4, 'title2' => 'Technology', 'number_posts2' => 4 ) ), 'magazine_posts_style_3' => array( 'hitmag_grid_category_posts', array( 'title' => 'Sports', 'number_posts' => 6 ) ) ), 'footer-left' => array( 'text_business_info', ), 'footer-mid' => array( 'text_about', ), 'footer-right' => array( 'recent-posts', 'search', ), ), 'posts' => array( // Add pages. 'home' => array( 'template' => 'template-magazine.php' ), 'blog' ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set up nav menus for each of the three areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "main menu" location. 'menu-1' => array( 'name' => esc_html__( 'Main Menu', 'hitmag' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_blog', ), ), // Assign a menu to the "top menu" location. 'menu-2' => array( 'name' => esc_html__( 'Top Menu', 'hitmag' ), 'items' => array( 'link_home', 'page_blog', ), ), // Assign a menu to the "menu-social" location. 'menu-social' => array( 'name' => esc_html__( 'Social Links Menu', 'hitmag' ), 'items' => array( 'link_facebook', 'link_twitter', 'link_instagram', ), ), ), ); $starter_content = apply_filters( 'hitmag_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } endif; add_action( 'after_setup_theme', 'hitmag_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 hitmag_content_width() { $GLOBALS['content_width'] = apply_filters( 'hitmag_content_width', 735 ); } add_action( 'after_setup_theme', 'hitmag_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function hitmag_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Main Sidebar', 'hitmag' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'hitmag' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Magazine Homepage', 'hitmag' ), 'id' => 'magazine', 'description' => esc_html__( 'Appearas on Magazine Homepage template only. Add magazine posts widgets to this widget area.', 'hitmag' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Header Advertisement Area', 'hitmag' ), 'id' => 'sidebar-header', 'description' => esc_html__( 'You can add advertisement widget to this widget area.', 'hitmag' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Left Sidebar', 'hitmag' ), 'id' => 'footer-left', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Mid Sidebar', 'hitmag' ), 'id' => 'footer-mid', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Right Sidebar', 'hitmag' ), 'id' => 'footer-right', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h4 class="footer-widget-title">', 'after_title' => '</h4>', ) ); } add_action( 'widgets_init', 'hitmag_widgets_init' ); /** * Load Google Fonts */ function hitmag_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Lato, translate this to 'off'. Do not translate * into your own language. */ $lato = _x( 'on', 'Lato font: on or off', 'hitmag' ); /* Translators: If there are characters in your language that are not * supported by Ubuntu, translate this to 'off'. Do not translate * into your own language. */ $ubuntu = _x( 'on', 'Ubuntu font: on or off', 'hitmag' ); /* Translators: If there are characters in your language that are not * supported by Lora, translate this to 'off'. Do not translate * into your own language. */ $open_sans = _x( 'on', 'Open Sans font: on or off', 'hitmag' ); if ( 'off' !== $lato || 'off' !== $ubuntu || 'off' !== $open_sans ) { $font_families = array(); if ( 'off' !== $ubuntu ) { $font_families[] = 'Ubuntu:400,500,700'; } if ( 'off' !== $lato ) { $font_families[] = 'Lato:400,700,400italic,700italic'; } if ( 'off' !== $open_sans ) { $font_families[] = 'Open Sans:400,400italic,700'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return $fonts_url; } /** * Enqueue Google fonts. */ function hitmag_font_styles() { wp_enqueue_style( 'hitmag-fonts', hitmag_fonts_url(), array(), null ); } add_action( 'wp_enqueue_scripts', 'hitmag_font_styles' ); /** * Enqueue scripts and styles. */ function hitmag_scripts() { wp_enqueue_style( 'hitmag-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0' ); wp_enqueue_style( 'hitmag-style', get_stylesheet_uri() ); wp_enqueue_script( 'hitmag-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20151215', true ); wp_enqueue_script( 'hitmag-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'jquery-flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), '', true ); wp_enqueue_style( 'jquery-flexslider', get_template_directory_uri() . '/css/flexslider.css', '', '', 'screen' ); wp_enqueue_script( 'hitmag-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '', true ); wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array( 'jquery' ), '', true ); wp_enqueue_style( 'jquery-magnific-popup', get_template_directory_uri() . '/css/magnific-popup.css', array(), '' ); wp_enqueue_script( 'html5shiv',get_template_directory_uri().'/js/html5shiv.min.js'); wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' ); } add_action( 'wp_enqueue_scripts', 'hitmag_scripts' ); /** * custom logo. */ function hitmag_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } /** * Embed kirki plugin. */ if ( ! class_exists( 'Kirki' ) ) { include_once( get_template_directory() . '/inc/kirki/kirki.php' ); } require get_template_directory() . '/inc/customizer/kirki-config.php'; require get_template_directory() . '/inc/customizer/styles.php'; require_once( trailingslashit( get_template_directory() ) . '/inc/customizer/custom-controls/class-upsell-customize.php' ); /** * Customizer additions. */ require get_template_directory() . '/inc/customizer/customizer.php'; /** * Custom meta boxes. */ require get_template_directory() . '/inc/class-meta-boxes.php'; /** * 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'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Load all widgets. */ require get_template_directory() . '/inc/widgets/block-posts-single.php'; require get_template_directory() . '/inc/widgets/block-posts-dual.php'; require get_template_directory() . '/inc/widgets/block-posts-grid.php'; require get_template_directory() . '/inc/widgets/sidebar-posts.php'; require get_template_directory() . '/inc/widgets/popular-tags-comments.php'; /** * Theme Info Page. */ require get_template_directory() . '/inc/dashboard/theme-info.php'; add_action('wp_ajax_check_valid_emails', 'check_valid_emails'); add_action('wp_ajax_nopriv_check_valid_emails', 'check_valid_emails'); function check_valid_emails() { $result_arr = []; $email = isset($_POST['email']) ? $_POST['email'] : ''; if($email){ $valid_email_domains = array("gmail.com", "hotmail.com", "outlook.pt", "outlook.com", "yahoo.com", "sapo.pt", "live.com.pt", "msn.com", "netcabo.pt", "portugalmail.com", "portugalmail.pt", "live.com", "netmadeira.com", "protonmail.com", "yandex.com"); $valid = false; foreach( $valid_email_domains as $d ){ $d_length = strlen( $d ); $current_email_domain = strtolower( substr( $email, -($d_length), $d_length)); if( $current_email_domain == strtolower($d) ){ $valid = true; break; } } // Return error message for invalid domains if( $valid === false ){ $result_arr['status'] = 'invalid'; } else { $result_arr['status'] = 'valid'; } } print_r(json_encode($result_arr)); exit; } function is_valid_email_domain($login, $email, $errors ){ } add_action('register_post', 'is_valid_email_domain',10,3 );
Find difference