for posts and comments. */ add_theme_support( 'automatic-feed-links' ); /* * Supporting title tag via add_theme_support (since WordPress 4.1) */ add_theme_support( 'title-tag' ); /* * This theme supports a variety of post formats. */ add_theme_support( 'post-formats', array( 'aside', 'gallery', 'image', 'video', 'quote', 'audio', 'link' ) ); /* * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Primary Menu', 'profit-lite' ) ) ); /* * This theme uses its own gallery styles. */ add_filter( 'use_default_gallery_style', '__return_false' ); /* * Add theme support post thumbnails. */ if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 870, 480, true ); } add_image_size( 'mp-profit-thumb-medium-column', 570, 265, true ); add_image_size( 'mp-profit-thumb-medium-masonry', 570, 9999, false ); add_image_size( 'mp-profit-thumb-large', 1170, 483, true ); add_image_size( 'mp-profit-thumb-related', 370, 192, true ); add_image_size( 'mp-profit-thumb-slide-medium', 1024, 623, true ); add_image_size( 'mp-profit-thumb-slide-small', 768, 623, true ); add_theme_support( 'custom-logo', array( 'header-text' => array( 'header-logo'), )); } add_action( 'after_setup_theme', 'mp_profit_setup' ); /* * Profit admin js. * * Add js for customizer. * * @since profit 1.1.0 */ function mp_profit_enqueue() { if ( is_callable( 'is_customize_preview' ) && is_customize_preview() ) { wp_enqueue_script( 'mp-profit-sections', get_template_directory_uri() . '/js/theme-sections.min.js', '', mp_profit_get_theme_version(), true ); } } add_action( 'admin_enqueue_scripts', 'mp_profit_enqueue' ); /** * Profit page menu. * * Show pages of site. * * @since profit 1.0 */ function mp_profit_wp_page_menu() { echo '
'; } /** * Profit page top menu. * * Show pages of site. * * @since profit 1.0 */ function mp_profit_wp_page_short_menu() { echo ' '; } /** * Profit Mobile Menu * * Show menu or pages of site. * * @since profit 1.0 */ require get_template_directory() . '/inc/theme/nav-menu-dropdown.php'; function mp_profit_mobile_menu() { if ( has_nav_menu( 'primary' ) ) : wp_nav_menu( array( 'theme_location' => 'primary', 'walker' => new MP_Profit_Walker_Nav_Menu_Dropdown(), 'items_wrap' => '', ) ); else: echo ' '; endif; } function mp_profit_before_header() { do_action( 'mp_profit_before_header' ); } add_action( 'mp_profit_before_header', 'be_mobile_menu' ); /* Return the Google font stylesheet URL, if available. * * The use of Open Sans by default is localized. * * @since 1.0.0 * @access public * @return void */ function mp_profit_load_google_fonts() { wp_register_style( 'googleLato', 'https://fonts.googleapis.com/css?family=Lato:400,300,700,300italic,400italic,700italic' ); wp_enqueue_style( 'googleLato' ); } add_action( 'wp_enqueue_scripts', 'mp_profit_load_google_fonts' ); /** * Enqueue scripts and styles for the front end. */ function mp_profit_scripts_styles() { /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } /* * Scripts for template masonry blog */ $mp_profit_blog_type = esc_html( get_theme_mod( 'mp_profit_blog_style', 'masonry' ) ); if ( is_home() && $mp_profit_blog_type === 'masonry' ) : wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'jquery.infinitescroll', get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array( 'jquery' ), '2.1.0', true ); endif; wp_enqueue_script( 'superfish.min', get_template_directory_uri() . '/js/superfish.min.js', array( 'jquery', 'hoverIntent' ), '1.7.5', true ); wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array( 'jquery', 'hoverIntent' ), '2.5.0', true ); wp_enqueue_script( 'mp-profit-script', get_template_directory_uri() . '/js/profit.min.js', array( 'jquery', 'superfish.min', 'flexslider' ), mp_profit_get_theme_version(), true ); $data_array = array( 'url' => get_template_directory_uri(), 'menu_smooth_scroll' => apply_filters('mp_profit_menu_smooth_scroll_enabled', true), 'invest_result' => __( 'Results Summary', 'profit-lite' ), 'invest_start' => __( 'Starting amount', 'profit-lite' ), 'invest_years' => __( 'Years to invest', 'profit-lite' ), 'invest_rate' => __( 'Hypothetical annual rate of return', 'profit-lite' ), 'invest_total' => __( 'Total amount invested', 'profit-lite' ), 'invest_ending' => __( 'Ending investment balance', 'profit-lite' ), 'invest_year' => __( 'Year', 'profit-lite' ), 'invest_earnings' => __( 'Earnings', 'profit-lite' ), 'invest_balance' => __( 'Balance', 'profit-lite' ), ); wp_localize_script( 'mp-profit-script', 'mp_profit_script_data', $data_array ); /* * Loads Profit Styles */ wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.5', 'all' ); wp_enqueue_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.min.css', array( 'bootstrap' ), '2.5.0', 'all' ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array( 'bootstrap' ), '4.3.0', 'all' ); wp_enqueue_style( 'mp-profit-main', get_template_directory_uri() . '/css/profit-style.min.css', array( 'bootstrap', 'font-awesome' ), mp_profit_get_theme_version(), 'all' ); if ( is_plugin_active( 'motopress-content-editor/motopress-content-editor.php' ) || is_plugin_active( 'motopress-content-editor-lite/motopress-content-editor.php' ) ) { wp_enqueue_style( 'mp-profit-motopress', get_template_directory_uri() . '/css/profit-motopress.min.css', array( 'bootstrap', 'font-awesome', 'mp-profit-main' ), mp_profit_get_theme_version(), 'all' ); } if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) { wp_enqueue_style( 'mp-profit-woocommerce', get_template_directory_uri() . '/css/profit-woocommerce.min.css', array( 'bootstrap', 'font-awesome', 'mp-profit-main' ), mp_profit_get_theme_version(), 'all' ); } if ( is_plugin_active( 'bbpress/bbpress.php' ) ) { wp_enqueue_style( 'mp-profit-bbpress', get_template_directory_uri() . '/css/profit-bbpress.min.css', array( 'bootstrap', 'font-awesome', 'mp-profit-main' ), mp_profit_get_theme_version(), 'all' ); } if ( is_plugin_active( 'buddypress/bp-loader.php' ) ) { wp_enqueue_style( 'mp-profit-buddypress', get_template_directory_uri() . '/css/profit-buddypress.min.css', array( 'bootstrap', 'font-awesome', 'mp-profit-main' ), mp_profit_get_theme_version(), 'all' ); } if ( is_rtl() ) { wp_enqueue_style( 'mp-profit-rtl', get_template_directory_uri() . '/css/profit-rtl.min.css', array( 'bootstrap', 'font-awesome', 'mp-profit-main' ), mp_profit_get_theme_version(), 'all' ); } /* * Loads our main stylesheet. */ wp_enqueue_style( 'mp-profit-style', get_stylesheet_uri(), array(), mp_profit_get_theme_version() ); } add_action( 'wp_enqueue_scripts', 'mp_profit_scripts_styles' ); /** * Title Tag backwards compatibility for older versions * */ if ( ! function_exists( '_wp_render_title_tag' ) ) { function mp_profit_slug_render_title() { ?> __( 'Main Widget Area', 'profit-lite' ), 'id' => 'sidebar-1', 'description' => __( 'Appears on posts and pages in the sidebar.', 'profit-lite' ), 'before_widget' => ' ', 'before_title' => '
' );
$content = wp_kses( $content, array( 'p' => array() ) );
} else {
$content = strip_tags( $content );
$content = wp_kses( $content, array() );
}
if ( strlen( $content ) > $contentLength ) {
$content = extension_loaded( 'mbstring' ) ? mb_substr( $content, 0, $contentLength ) . apply_filters('excerpt_more', '...') : substr( $content, 0, $contentLength ) . apply_filters('excerpt_more', '...');
}
$content = apply_filters('mp_profit_get_content_theme', $content);
echo $content;
}
if ( current_user_can( 'install_plugins' ) ) {
require get_template_directory() . '/inc/theme/tgm-init.php';
}
function mp_profit_get_post_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all( '/