version );
define('SITEURL', get_site_url() );
if ( ! function_exists( 'boatdealer_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.
*
* @since boatdealer 1.0
*/
function boatdealer_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on boatdealer, use a find and replace
* to change 'boatdealer' to the name of your theme in all the template files
*/
load_theme_textdomain( 'boatdealer', 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.
*
* See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 825, 510, true );
/*
* 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'
) );
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
) );
/*
* Enable support for custom logo.
*
* @since boatdealer 1.0
*/
add_theme_support( 'custom-logo', array(
'height' => 300,
'width' => 300,
'flex-height' => true,
) );
$color_scheme = boatdealer_get_color_scheme();
$default_color = trim( $color_scheme[0], '#' );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'boatdealer_custom_background_args', array(
'default-color' => $default_color,
'default-attachment' => 'fixed',
) ) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css') );
}
endif; // boatdealer_setup
add_action( 'after_setup_theme', 'boatdealer_setup' );
/**
*
* @since boatdealer 1.0
*
* @link https://codex.wordpress.org/Function_Reference/register_sidebar
*/
/**
* JavaScript Detection.
*
* Adds a `js` class to the root `` element when JavaScript is detected.
*
* @since boatdealer 1.1
*/
function boatdealer_javascript_detection() {
echo "\n";
}
add_action( 'wp_head', 'boatdealer_javascript_detection', 0 );
/**
* Enqueue scripts and styles.
*
* @since boatdealer 1.0
*/
function boatdealer_scripts() {
// Add Genericons, used in the main stylesheet.
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' );
// Load our main stylesheet.
wp_enqueue_style( 'boatdealer-style', get_stylesheet_uri() );
// Load the Internet Explorer specific stylesheet.
wp_enqueue_style( 'boatdealer-ie', get_template_directory_uri() . '/css/ie.css', array( 'boatdealer-style' ), '20141010' );
wp_style_add_data( 'boatdealer-ie', 'conditional', 'lt IE 9' );
// Load the Internet Explorer 7 specific stylesheet.
wp_enqueue_style( 'boatdealer-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'boatdealer-style' ), '20141010' );
wp_style_add_data( 'boatdealer-ie7', 'conditional', 'lt IE 8' );
wp_enqueue_script( 'boatdealer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'boatdealer-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' );
}
wp_enqueue_script( 'boatdealer-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
wp_localize_script( 'boatdealer-script', 'screenReaderText', array(
'expand' => '' . __( 'expand child menu', 'boatdealer' ) . '',
'collapse' => '' . __( 'collapse child menu', 'boatdealer' ) . '',
) );
wp_enqueue_style( 'slicknav', get_template_directory_uri() . '/slick/css/slicknav.css' );
wp_enqueue_style( 'slicknav', get_template_directory_uri() . '/slick/css/default.css' );
wp_enqueue_script ( 'slickjs' , get_template_directory_uri() . '/slick/js/jquery.slicknav.js', array( 'jquery' ), '1.0.4', false );
wp_enqueue_script('jquery-effects-core', '', '', array('jquery'));
}
add_action( 'wp_enqueue_scripts', 'boatdealer_scripts' );
/**
* Add featured image as background image to post navigation elements.
*
* @since boatdealer 1.0
*
* @see wp_add_inline_style()
*/
function boatdealer_post_nav_background() {
if ( ! is_single() ) {
return;
}
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
$css = '';
if ( is_attachment() && 'attachment' == $previous->post_type ) {
return;
}
if ( $previous && has_post_thumbnail( $previous->ID ) ) {
$prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' );
$css .= '
.post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); }
.post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; }
.post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); }
';
}
if ( $next && has_post_thumbnail( $next->ID ) ) {
$nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' );
$css .= '
.post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; }
.post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; }
.post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); }
';
}
wp_add_inline_style( 'boatdealer-style', $css );
}
add_action( 'wp_enqueue_scripts', 'boatdealer_post_nav_background' );
/**
* Navigation
*
* @since boatdealer 1.0
*
*/
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'top-menu' => __( 'Top Menu', 'boatdealer' ),
'primary' => __( 'Primary Menu', 'boatdealer' ),
'social' => __( 'Social Links Menu', 'boatdealer' ),
) );
/**
* Add a `screen-reader-text` class to the search form's submit button.
*
* @since boatdealer 1.0
*
* @param string $html Search form HTML.
* @return string Modified search form HTML.
*/
function boatdealer_search_form_modify( $html ) {
return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html );
}
add_filter( 'get_search_form', 'boatdealer_search_form_modify' );
/**
* Implement the Custom Header feature.
*
* @since boatdealer 1.0
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*
* @since boatdealer 1.0
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*
* @since boatdealer 1.0
*/
/**
* Suggest plugins.
*
* @since boatdealer 1.0
*/
require_once get_template_directory() . '/inc/pinstaller.php';
require get_template_directory() . '/inc/customizer.php';
/**
* Widgets
*
* @since boatdealer 1.0
*
*/
function boatdealer_widget_init()
{
register_sidebar( array(
'name' => __( 'Sidebar Widget Area', 'boatdealer' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar.', 'boatdealer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar(array(
'name' => __( 'First Footer Widget', 'boatdealer' ),
'id' => '1-footer',
'description' => __( 'Add widgets here to appear in your left footer.', 'boatdealer' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __( 'Second Footer Widget', 'boatdealer' ),
'id' => '2-footer',
'description' => __( 'Add widgets here to appear in your center footer.', 'boatdealer' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __( 'Third Footer Widget', 'boatdealer' ),
'id' => '3-footer',
'description' => __( 'Add widgets here to appear in your right.', 'boatdealer' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
}
add_action('widgets_init', 'boatdealer_widget_init');
/**
* Tiny MCE Extra Buttons
*
* @since boatdealer 1.0
*
*/
if ( ! function_exists( 'boatdealer_wp_mce_buttons' ) ) {
function boatdealer_wp_mce_buttons( $buttons ) {
array_unshift( $buttons, 'fontselect' ); // Add Font Select
array_unshift( $buttons, 'fontsizeselect' ); // Add Font Size Select
array_unshift( $buttons, 6,0, 'backcolor' );
return $buttons;
}
}
add_filter( 'mce_buttons_2', 'boatdealer_wp_mce_buttons' );
/**
* Add support to WooCommerce
*
* @since boatdealer 1.0
*
*/
add_action( 'after_setup_theme', 'boatdealer_woocommerce_support' );
function boatdealer_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
function boat_sanitizehtml( $str ) {
$allowed_html = array(
'a' => array(
'href' => true,
'title' => true,
),
'abbr' => array(
'title' => true,
),
'acronym' => array(
'title' => true,
),
'b' => array(),
'blockquote' => array(
'cite' => true,
),
'cite' => array(),
'code' => array(),
'del' => array(
'datetime' => true,
),
'em' => array(),
'i' => array(),
'q' => array(
'cite' => true,
),
'strike' => array(),
'strong' => array(),
);
wp_kses($str, $allowed_html);
return $str ;
}
if ( ! function_exists( 'boatdealer_import_files' ) ) :
function boatdealer_import_files() {
$important_notice = 'Important Notes:
We recommend to run the Demo Import on a clean WordPress installation.
To reset your installation (if the import fails) we recommend Wordpress Reset Plugin.
Do not run the Demo Import multiple times, it will result in duplicated content.
After you import this demo, you will have to setup the slider separately.';
return array(
array(
'import_file_name' => 'Demo Import 1',
'import_file_url' => 'http://www.boatdealerthemes.com/demo/demo-content.xml',
'import_widget_file_url' => 'http://www.boatdealerthemes.com/demo/widgets.json',
'import_customizer_file_url' => 'http://www.boatdealerthemes.com/demo/customizer.dat',
'import_notice' => $important_notice,
),
);
}
endif;
add_filter( 'pt-ocdi/import_files', 'boatdealer_import_files' );
if ( ! function_exists( 'boatdealer_after_import' ) ) :
function boatdealer_after_import( $selected_import ) {
//Set Menu
$social_menu = get_term_by('name', 'social menu', 'nav_menu');
$main_menu = get_term_by('name', 'Main Menu', 'nav_menu');
set_theme_mod( 'nav_menu_locations' , array(
'primary' => $main_menu->term_id,
'top-menu' => $main_menu->term_id,
'social' => $social_menu->term_id
)
);
// Assign front page and posts page (blog page).
$front_page_id = get_page_by_title( 'Home' );
$blog_page_id = get_page_by_title( 'Blog' );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $front_page_id->ID );
update_option( 'page_for_posts', $blog_page_id->ID );
}
add_action( 'pt-ocdi/after_import', 'boatdealer_after_import' );
endif;
require_once( trailingslashit( get_template_directory() ) . 'trt-customize-pro/class-customize.php' );
function boatdealer_admin_notice() {
echo '';
echo '
';
echo '
';
$bd_msg = '
Welcome. BoatDealer Theme was activated!
';
$bd_msg .= '
For details and help, take a look at our Help Page at your left menu Appearance => BoatDealer Theme Help';
$bd_url = ' or click here';
$bd_msg .= '
';
$bd_msg .= $bd_url;
echo $bd_msg;
echo "";
echo "
";
}
function boatdealer_theme_was_activated() {
add_action('admin_notices', 'boatdealer_admin_notice');
$bill_installed = trim(get_option( 'bill_installed',''));
if(empty($bill_installed)){
add_option( 'bill_installed', time() );
update_option( 'bill_installed', time() );
}
}
if(is_admin())
{
add_action("after_switch_theme", "boatdealer_theme_was_activated");
require_once (BOATDEALERPATH . '/inc/activated-manager.php');
require_once (BOATDEALERPATH . "/inc/feedback-last.php");
if(memory_status())
require_once(BOATDEALERPATH . '/inc/feedback.php');
require_once BOATDEALERPATH . '/inc/help.php';
function boatdealer_custom_dashboard_help() {
echo '
';
echo '';
echo '
';
echo '';
$bd_msg = 'For details and help, take a look at our Help Page at your left menu';
$bd_msg .= '
';
$bd_msg .= 'Appearance => BoatDealer Theme Help';
$bd_msg .= '
';
$bd_msg .= ' Help Page';
$bd_msg .= ' ';
$bd_url = ' Visit Our Site';
$bd_msg .= $bd_url;
$bd_msg .= ' ';
$bd_url = 'OnLine Guide';
$bd_msg .= $bd_url;
// $bd_msg .= ', Support, Demo Video and more.';
echo $bd_msg;
echo "";
echo "
";
}
function boatdealer_add_dashboard_widgets()
{
add_meta_box('boatdealer-dashboard', 'Boat Dealer Theme Help and Support', 'boatdealer_custom_dashboard_help', 'dashboard', 'normal', 'high');
}
add_action("wp_dashboard_setup", "boatdealer_add_dashboard_widgets");
function boatdealer_memory_notice() {
if(isset($_GET["tab"]))
{
if (strip_tags($_GET["tab"]) == 'memory')
return;
}
echo '';
echo '
';
$bd_msg = '
Boat Dealer Theme running in save memory mode.
';
$bd_msg .= '
To release all theme power, please, increase the WordPress memory limit.';
$bd_msg .= ' For details and help, take a look at our Help Page (memory tab) at your left menu Appearance => For Dummies Help';
$bd_url = ' or click here';
$bd_msg .= '
';
$bd_msg .= $bd_url;
echo $bd_msg;
echo "";
echo "
";
}
if(! memory_status())
add_action( 'admin_notices', 'boatdealer_memory_notice' );
}
if (get_site_option('boatdealer_update_theme', '0') == '1')
add_filter( 'auto_update_theme', '__return_true' );
function memory_status()
{
$r = false;
if(defined("WP_MEMORY_LIMIT"))
{
$wplimit = trim(WP_MEMORY_LIMIT) ;
$wplimit = substr($wplimit,0,strlen($wplimit)-1);
if($wplimit >= 128)
$r = true;
}
return $r;
}
?>