get_bloginfo('name'), ) ); // Support HTML5 Markup Search Form add_theme_support( 'html5', array( 'search-form' ) ); // Featured Images in Posts/Pages add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); // Automatic Feed Links add_theme_support( 'automatic-feed-links' ); // Custom Header add_theme_support( 'custom-header' ); // Custom Background // add_theme_support( 'custom-background' ); // Add Editor Style function wpdocs_theme_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' ); // Remove Automatic Paragraphs remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop', 99 ); // Enable Shortcodes in Text Widgets add_filter('widget_text','do_shortcode'); // WP Link Pages $defaults = array( 'before' => '
' . esc_html__( 'Pages:', 'mnmlwp' ), 'after' => '
', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'number', 'separator' => ' ', 'nextpagelink' => esc_html__( 'Next page', 'mnmlwp'), 'previouspagelink' => esc_html__( 'Previous page', 'mnmlwp' ), 'pagelink' => '%', 'echo' => 1 ); wp_link_pages( $defaults ); // Content Width if ( ! isset( $content_width ) ) $content_width = 1920; // mnmlWP Plugin Activation require_once( dirname(__FILE__) . '/inc/class-tgm-plugin-activation.php' ); add_action( 'tgmpa_register', 'mnmlwp_register_required_plugins' ); function mnmlwp_register_required_plugins() { $plugins = array( array( 'name' => 'mnmlWP Shortcodes', 'slug' => 'mnmlwp-shortcodes', // 'source' => get_template_directory() . '/lib/plugins/tgm-example-plugin.zip', // The plugin source. 'source' => 'https://mnmlwp.de/update/downloads/plugins/mnmlwp-shortcodes-0.1.5.zip', // The plugin source. 'required' => false, // If false, the plugin is only 'recommended' instead of required. 'version' => '0.1.5', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. // 'external_url' => 'https://sebastianhonert.com/mnmlwp/update/downloads/plugins/mnmlwp-contact-form-0.1.1.zip', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), array( 'name' => 'mnmlWP Contact Form', 'slug' => 'mnmlwp-contact-form', // 'source' => get_template_directory() . '/lib/plugins/tgm-example-plugin.zip', // The plugin source. 'source' => 'https://mnmlwp.de/update/downloads/plugins/mnmlwp-contact-form-0.1.4.zip', // The plugin source. 'required' => false, // If false, the plugin is only 'recommended' instead of required. 'version' => '0.1.4', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'mnmlwp', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. 'strings' => array( 'page_title' => esc_html__( 'Install Required Plugins', 'mnmlwp' ), 'menu_title' => esc_html__( 'Install Plugins', 'mnmlwp' ), /* translators: %s: plugin name. */ 'installing' => esc_html__( 'Installing Plugin: %s', 'mnmlwp' ), /* translators: %s: plugin name. */ 'updating' => esc_html__( 'Updating Plugin: %s', 'mnmlwp' ), 'oops' => esc_html__( 'Something went wrong with the plugin API.', 'mnmlwp' ), 'notice_can_install_required' => _n_noop( /* translators: 1: plugin name(s). */ 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.', 'mnmlwp' ), 'notice_can_install_recommended' => _n_noop( /* translators: 1: plugin name(s). */ 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'mnmlwp' ), 'notice_ask_to_update' => _n_noop( /* translators: 1: plugin name(s). */ 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'mnmlwp' ), 'notice_ask_to_update_maybe' => _n_noop( /* translators: 1: plugin name(s). */ 'There is an update available for: %1$s.', 'There are updates available for the following plugins: %1$s.', 'mnmlwp' ), 'notice_can_activate_required' => _n_noop( /* translators: 1: plugin name(s). */ 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'mnmlwp' ), 'notice_can_activate_recommended' => _n_noop( /* translators: 1: plugin name(s). */ 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'mnmlwp' ), 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'mnmlwp' ), 'update_link' => _n_noop( 'Begin updating plugin', 'Begin updating plugins', 'mnmlwp' ), 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins', 'mnmlwp' ), 'return' => esc_html__( 'Return to Required Plugins Installer', 'mnmlwp' ), 'plugin_activated' => esc_html__( 'Plugin activated successfully.', 'mnmlwp' ), 'activated_successfully' => esc_html__( 'The following plugin was activated successfully:', 'mnmlwp' ), /* translators: 1: plugin name. */ 'plugin_already_active' => esc_html__( 'No action taken. Plugin %1$s was already active.', 'mnmlwp' ), /* translators: 1: plugin name. */ 'plugin_needs_higher_version' => esc_html__( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'mnmlwp' ), /* translators: 1: dashboard link. */ 'complete' => esc_html__( 'All plugins installed and activated successfully. %1$s', 'mnmlwp' ), 'dismiss' => esc_html__( 'Dismiss this notice', 'mnmlwp' ), 'notice_cannot_install_activate' => esc_html__( 'There are one or more required or recommended plugins to install, update or activate.', 'mnmlwp' ), 'contact_admin' => esc_html__( 'Please contact the administrator of this site for help.', 'mnmlwp' ), 'nag_type' => '', // Determines admin notice type - can only be one of the typical WP notice classes, such as 'updated', 'update-nag', 'notice-warning', 'notice-info' or 'error'. Some of which may not work as expected in older WP versions. ), ); tgmpa( $plugins, $config ); } // Customizer & Alpha Color Picker function mnmlwp_customize_register_acp( $wp_customize ) { require_once( realpath(dirname(__FILE__) . '/inc/alpha-color-picker/alpha-color-picker.php') ); } add_action( 'customize_register', 'mnmlwp_customize_register_acp' ); include 'functions/customizer.php'; include 'inc/customizer-reset/customizer-reset.php'; // Breadcrumbs include 'functions/breadcrumbs.php'; // Demo Content include 'demo/functions.php'; // Updater require_once( dirname(__FILE__) . '/functions/update.php' ); // Disable Rich Text Editor // function mnmlwp_disable_richedit() { // return false; // } // // add_filter( 'user_can_richedit', 'mnmlwp_disable_richedit' ); // Main Navigation function mnmlwp_register_main_navigation() { register_nav_menus( array( 'main-nav' => esc_html__( 'Main Navigation', 'mnmlwp' ), ) ); } add_action('after_setup_theme', 'mnmlwp_register_main_navigation'); // Show Navigation/Menu if( ! function_exists ( 'mnmlwp_nav' ) ) { function mnmlwp_nav() { if ( has_nav_menu( 'main-nav' ) ) { echo ''; echo '' . esc_html__('Please enter a search term.', 'mnmlwp') . '
'; $html .= get_search_form( false ); return $html; } } if( have_posts() ) : $html .= '' . get_the_excerpt() . '
'; if( $num_comments > 0 ) $html .= '' . $num_comments . ' ' . esc_html__('comment(s)', 'mnmlwp') . '
'; } $html .= '' . esc_html__('No posts found. You might want to use the search form or go back to the home page.', 'mnmlwp') . '
'; endif; // Paginate if( ! $cat ) $html .= mnmlwp_paginate_links( $paged ); wp_reset_query(); wp_reset_postdata(); return $html; } } // Post Meta if( ! function_exists ( 'mnmlwp_get_post_meta' ) ) { function mnmlwp_get_post_meta( $post_id, $components = null ) { if( $components === null ) { $components = array( 'author', 'date', 'categories', 'tags', ); } else { $componets = array_map( 'esc_attr', $components ); } $divider = ''; // $author_title = ' '; $author_title = ''; $author = in_array( 'author', $components ) && get_post_type() === 'post' ? $author_title . '' . get_the_author_meta('display_name') . '' . $divider : ''; $date = in_array( 'date', $components ) ? get_the_date() : ''; $html = ' '; return $html; } } // Get Categories if( ! function_exists( 'mnmlwp_get_post_categories' ) ) { function mnmlwp_get_post_categories( $post_id ) { $categories = wp_get_post_categories( $post_id ); if( empty( $categories ) ) return; $html = '' . sprintf( esc_html__('You successfully installed the mnmlWP WordPress Theme. Please update your theme settings in the %1$s.', 'mnmlwp'), 'Customizer' ) . '
'; $welcome .= '' . esc_html__('Enjoy your mnmlWP site!', 'mnmlwp') . '
'; $welcome .= '' . esc_attr__('Pick a Category Color', 'mnmlwp') . '
' . esc_html__('Attention', 'mnmlwp') . ':' . esc_html__('The breadcrumb navigation is globally disabled in the theme customization options.', 'mnmlwp') . '
'; } } function mnmlwp_add_meta_boxes_hide_contact_row_callback( $post ) { $theme_has_contact_row = get_theme_mod( 'mnmlwp_has_contact_row', true ); $mnmlwp_hide_contact_row = get_post_meta( $post->ID, '_mnmlwp_hide_contact_row', true ); $checked = $mnmlwp_hide_contact_row == 1 ? 'checked' : ''; $disabled = $theme_has_contact_row ? '' : 'disabled="disabled"'; echo ' ' . esc_html__('Check to hide the contact row on this page.', 'mnmlwp'); if( ! $theme_has_contact_row ) { echo '' . esc_html__('Attention', 'mnmlwp') . ':' . esc_html__('The contact row is globally disabled in the theme customization options.', 'mnmlwp') . '
'; } } function mnmlwp_add_meta_boxes_hero_image_callback( $post ) { $hero_title = get_post_meta( $post->ID, '_mnmlwp_hero_title', true ); $has_overlay = get_post_meta( $post->ID, '_mnmlwp_hero_has_overlay', true ); $has_overlay_checked = $has_overlay == 1 ? 'checked' : ''; $hero_overlay_color = get_post_meta( $post->ID, '_mnmlwp_hero_overlay_color', true ); $hero_overlay_opacity = get_post_meta( $post->ID, '_mnmlwp_hero_overlay_opacity', true ) ? get_post_meta( $post->ID, '_mnmlwp_hero_overlay_opacity', true ) : '30'; $has_radial_gradient = get_post_meta( $post->ID, '_mnmlwp_hero_has_radial_gradient', true ); $has_radial_gradient_checked = $has_radial_gradient == 1 ? 'checked' : ''; $has_skew = get_post_meta( $post->ID, '_mnmlwp_hero_has_skew', true ); $has_skew_checked = $has_skew == 1 ? 'checked' : ''; $background_position_horizontal = get_post_meta( $post->ID, '_mnmlwp_hero_background_position_horizontal', true ) ? get_post_meta( $post->ID, '_mnmlwp_hero_background_position_horizontal', true ) : 'center'; $background_position_vertical = get_post_meta( $post->ID, '_mnmlwp_hero_background_position_vertical', true ) ? get_post_meta( $post->ID, '_mnmlwp_hero_background_position_vertical', true ) : 'center'; $has_background_attachment_fixed = get_post_meta( $post->ID, '_mnmlwp_hero_background_attachment_fixed', true ); $has_background_attachment_fixed_checked = $has_background_attachment_fixed == 1 ? 'checked' : ''; echo '' . esc_html__('Attention', 'mnmlwp'). '! ' . esc_html__('The fixed background setting overwrites the selected background position values. It is also not recommended to use the background overlay together with a fixed background, since the re-rendering of a transparent element might result in in jerky scrolling. The fixed background setting only takes effect with screen sizes >= 768px.', 'mnmlwp') . '
'; } /** * When the post is saved, saves our custom data. * * @param int $post_id */ function mnmlwp_add_meta_boxes_save( $post_id ) { if ( ! isset( $_POST['mnmlwp_add_meta_boxes_nonce'] ) ) return; if ( ! wp_verify_nonce( $_POST['mnmlwp_add_meta_boxes_nonce'], 'mnmlwp_add_meta_boxes_nonce' ) ) return; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { return; } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } } // Sanitize user input. $data['mnmlwp-show-sidebar'] = ! isset( $_POST['mnmlwp-show-sidebar'] ) ? 0 : 1; $data['mnmlwp-hide-page-title'] = ! isset( $_POST['mnmlwp-hide-page-title'] ) ? 0 : 1; $data['mnmlwp-hide-breadcrumbs'] = ! isset( $_POST['mnmlwp-hide-breadcrumbs'] ) ? 0 : 1; $data['mnmlwp-hide-contact-row'] = ! isset( $_POST['mnmlwp-hide-contact-row'] ) ? 0 : 1; $data['mnmlwp-hero-title'] = wp_kses_post( $_POST['mnmlwp-hero-title'] ); $data['mnmlwp-hero-has-overlay'] = ! isset( $_POST['mnmlwp-hero-has-overlay'] ) ? 0 : 1; $data['mnmlwp-hero-overlay-color'] = sanitize_text_field( $_POST['mnmlwp-hero-overlay-color'] ); $data['mnmlwp-hero-has-radial-gradient'] = ! isset( $_POST['mnmlwp-hero-has-radial-gradient'] ) ? 0 : 1; $data['mnmlwp-hero-overlay-opacity'] = (int)sanitize_text_field( $_POST['mnmlwp-hero-overlay-opacity'] ); if( $data['mnmlwp-hero-overlay-opacity'] > 100 ) { $data['mnmlwp-hero-overlay-opacity'] = 100; } if( $data['mnmlwp-hero-overlay-opacity'] < 0 ) { $data['mnmlwp-hero-overlay-opacity'] = 0; } $data['mnmlwp-hero-has-skew'] = ! isset( $_POST['mnmlwp-hero-has-skew'] ) ? 0 : 1; $data['mnmlwp-hero-background-position-horizontal'] = sanitize_text_field( $_POST['mnmlwp-hero-background-position-horizontal'] ); $data['mnmlwp-hero-background-position-vertical'] = sanitize_text_field( $_POST['mnmlwp-hero-background-position-vertical'] ); $data['mnmlwp-hero-background-attachment-fixed'] = ! isset( $_POST['mnmlwp-hero-background-attachment-fixed'] ) ? 0 : 1; update_post_meta( $post_id, '_mnmlwp_show_sidebar', $data['mnmlwp-show-sidebar'] ); update_post_meta( $post_id, '_mnmlwp_hide_page_title', $data['mnmlwp-hide-page-title'] ); update_post_meta( $post_id, '_mnmlwp_hide_breadcrumbs', $data['mnmlwp-hide-breadcrumbs'] ); update_post_meta( $post_id, '_mnmlwp_hide_contact_row', $data['mnmlwp-hide-contact-row'] ); update_post_meta( $post_id, '_mnmlwp_hero_title', $data['mnmlwp-hero-title'] ); update_post_meta( $post_id, '_mnmlwp_hero_has_overlay', $data['mnmlwp-hero-has-overlay'] ); update_post_meta( $post_id, '_mnmlwp_hero_overlay_color', $data['mnmlwp-hero-overlay-color'] ); update_post_meta( $post_id, '_mnmlwp_hero_has_radial_gradient', $data['mnmlwp-hero-has-radial-gradient'] ); update_post_meta( $post_id, '_mnmlwp_hero_overlay_opacity', $data['mnmlwp-hero-overlay-opacity'] ); update_post_meta( $post_id, '_mnmlwp_hero_has_skew', $data['mnmlwp-hero-has-skew'] ); update_post_meta( $post_id, '_mnmlwp_hero_background_position_horizontal', $data['mnmlwp-hero-background-position-horizontal'] ); update_post_meta( $post_id, '_mnmlwp_hero_background_position_vertical', $data['mnmlwp-hero-background-position-vertical'] ); update_post_meta( $post_id, '_mnmlwp_hero_background_attachment_fixed', $data['mnmlwp-hero-background-attachment-fixed'] ); } add_action( 'save_post', 'mnmlwp_add_meta_boxes_save' ); // Lists add mnmlWP class function mnmlwp_add_list_class_on_insert( $postarr ) { $postarr['post_content'] = str_replace('