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_menus( array( 'menu-1' => esc_html__( 'Primary', 'twohearts' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'twohearts_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'twohearts_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 twohearts_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'twohearts_content_width', 640 ); } add_action( 'after_setup_theme', 'twohearts_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function twohearts_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'twohearts' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'twohearts' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'twohearts_widgets_init' ); /** * Enqueue scripts and styles. */ function twohearts_scripts() { wp_enqueue_style( 'twohearts-style', get_stylesheet_uri() ); wp_enqueue_script( 'twohearts-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'twohearts-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' ); } } add_action( 'wp_enqueue_scripts', 'twohearts_scripts' ); /** * 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'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * Register menu position */ add_action( 'after_setup_theme', 'register_my_menu' ); function register_my_menu() { register_nav_menu( 'legal', __( 'Legal', 'twohearts' ) ); register_nav_menu( 'footer', __( 'Footer', 'twohearts' ) ); } /** * Hide Admin bar */ add_filter('show_admin_bar', '__return_false'); /* AJAX Login */ function ajax_login_init(){ wp_register_script('ajax-login-script', get_template_directory_uri() . '/ajax-login-script.js', array('jquery') ); wp_enqueue_script('ajax-login-script'); wp_localize_script( 'ajax-login-script', 'ajax_login_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'redirecturl' => home_url(), 'loadingmessage' => __('Bitte warten...','twohearts') )); // Enable the user with no privileges to run ajax_login() in AJAX add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' ); } // Execute the action only if the user isn't logged in if (!is_user_logged_in()) { add_action('init', 'ajax_login_init'); } function ajax_login(){ // First check the nonce, if it fails the function will break check_ajax_referer( 'ajax-login-nonce', 'security' ); // Nonce is checked, get the POST data and sign user on $info = array(); $info['user_login'] = $_POST['username']; $info['user_password'] = $_POST['password']; $info['remember'] = true; $user_signon = wp_signon( $info, false ); if ( is_wp_error($user_signon) ){ echo json_encode(array('loggedin'=>false, 'message'=>__('Dein Benutzername oder dein Passwort sind leider nicht korrekt. Bitte überprüfe deine Eingabe und versuche es erneut.','twohearts'))); } else { echo json_encode(array('loggedin'=>true, 'message'=>__('Login erfolgreich. Willkommen zurück!','twohearts'))); } die(); } // Remove p tags from category description remove_filter('term_description','wpautop'); add_action( 'admin_init', 'redirect_non_admin_users' ); /** * Redirect non-admin users to home page * * This function is attached to the 'admin_init' action hook. */ function redirect_non_admin_users() { if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] && ! current_user_can( 'administrator' ) && ! current_user_can( 'author' ) && ! current_user_can( 'praktikant' ) ) { wp_redirect( home_url() ); exit; } } /** Add featured images and description to og:image and og:description for social media */ add_action('wp_head', 'add_featured_socialmedia'); function add_featured_socialmedia(){ if( is_single() ) { echo ''; echo ''; } } function my_pre_save_flohpost( $post_id ) { // check if this is to be a new post if( $post_id != 'artikel_new' ) { return $post_id; } // Create a new post if($_POST['acf']['field_638ef7b35bd0f']) { $item_title = $_POST['acf']['field_638ef7b35bd0f']; } if($_POST['acf']['field_638524a2b75ee']) { $item_price = $_POST['acf']['field_638524a2b75ee']; } if($_POST['acf']['field_6385c2ad1f915']) { $category = $_POST['acf']['field_6385c2ad1f915']; } if($_POST['acf']['field_638524c8b75ef']) { $item_versand = $_POST['acf']['field_638524c8b75ef']; } if($_POST['acf']['field_638ef7d992d8f']) { $item_desc = $_POST['acf']['field_638ef7d992d8f']; } if($_POST['acf']['field_638ef8c0ba2b6']) { $teaser_text = $_POST['acf']['field_638ef8c0ba2b6']; } if($_POST['acf']['field_638efb8d2c541']) { $name = $_POST['acf']['field_638efb8d2c541']; } if($_POST['acf']['field_638f1563f99e5']) { $item_vorschaubild = $_POST['acf']['field_638f1563f99e5']; } if($_POST['acf']['field_638efbd15ba32']) { $item_bilder = $_POST['acf']['field_638efbd15ba32']; } if($_POST['acf']['field_638efd3429630']) { $datenschutz = $_POST['acf']['field_638efd3429630']; } // Neuen Beitrag erstellen $post = array( 'post_status' => 'publish', 'post_title' => $item_title, 'post_type' => 'flohmarktartikel', 'post_excerpt' => $item_desc, 'post_content' => $item_desc, ); // insert the post $post_id = wp_insert_post( $post ); set_post_thumbnail($post_id, $item_vorschaubild); $author_id = get_post_field ('post_author', $post_id); $current_user = wp_get_current_user(); $user_email= $current_user->user_email; //$headers .= 'From: 1001hochzeitsideen.com<"'.$user_email.'">'; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: 1001hochzeitsideen.com '.'<'.$user_email.'>' . "\r\n"; $email = "maria@1001hochzeitsideen.com"; $subject = 'Flohmarkt Item'; $message = 'Ein Flohmarktartikel wurde von ' .$user_email. ' hinzugefügt.'; mail($email, $subject, $message, $headers); // return the new ID return $post_id; } add_filter('acf/pre_save_post' , 'my_pre_save_flohpost', 10, 1 ); // remove WP Geo JS/CSS from the nybank page add_action( 'wp_print_scripts', 'deregister_javascript', 99999 ); function deregister_javascript() { if (is_page(565)) { wp_deregister_script( 'wp-maps', 'https://maps.googleapis.com/maps/api/js' ); wp_dequeue_script( 'wp-maps' ); } } function cf7_get_author_email($atts){ $value = ''; if(get_the_author_meta( 'user_email' )) { $value = get_the_author_meta( 'user_email' ); } return $value; } add_shortcode('CF7_AUTHOR_EMAIL', 'cf7_get_author_email'); add_filter( 'mailpoet_unsubscribe_confirmation_page', 'mp_modify_unsubscribe_confirmation_page', 10, 2); function mp_modify_unsubscribe_confirmation_page( $HTML, $unsubscribeUrl ) { $HTML = '
'; $HTML .= '
You can click here to unsubscribe.
'; $HTML .= '
'; return $HTML; } // Add capabilities to the 'praktikant' role function add_praktikant_capabilities() { $role = get_role( 'praktikant' ); $role->add_cap( 'publish_posts' ); $role->add_cap( 'edit_posts' ); $role->add_cap( 'delete_posts' ); // Add other capabilities for MailPoet subscribers if needed } add_action( 'init', 'add_praktikant_capabilities' ); // Remove unwanted menus for the 'praktikant' role function remove_praktikant_menus() { $user = wp_get_current_user(); if ( in_array( 'praktikant', (array) $user->roles ) ) { remove_menu_page( 'tools.php' ); // Remove Tools menu remove_menu_page( 'options-general.php' ); // Remove Settings menu remove_menu_page( 'edit.php?post_type=slider' ); remove_menu_page( 'edit.php?post_type=werbung' ); remove_menu_page( 'edit.php?post_type=flohmarktartikel' ); remove_menu_page( 'edit.php?post_type=budget' ); remove_menu_page( 'edit.php?post_type=checklist' ); remove_menu_page( 'edit.php?post_type=vendor' ); remove_menu_page( 'wpcf7' ); remove_menu_page( 'edit-comments.php' ); remove_menu_page( 'upload.php' ); remove_menu_page( 'wp-maps' ); remove_menu_page( 'edit.php?post_type=checkin' ); remove_menu_page( 'edit.php?post_type=product' ); remove_submenu_page('wpgmp_menu_slug', 'wpgmp_view_overview'); // Add other menu pages you want to remove } } function hide_wpmaps_submenu_css() { $user = wp_get_current_user(); if (in_array('praktikant', (array) $user->roles)) { echo ''; } } add_action('admin_head', 'hide_wpmaps_submenu_css'); add_action( 'admin_menu', 'remove_praktikant_menus', 999 );

Verlobungsring: Diese Bedeutungen stecken ...

VERLOBUNG

Ihr sagt ja! Der Verlobungsring ist das Erkennungszeichen für eure bevorstehende Hochzeit. Wir verraten dir, welche Traditionen und Bedeutungen mit diesem Schmuckstück verbunden sind.

Mehr erfahren

Was verändert sich rechtlich nach der Hoch...

PLANUNG, VERLOBUNG

Die Heirat ist eine der größten Entscheidungen, welche man in seinem Leben treffen kann. Hier erfährst du was, sich rechtlich nach der Heirat verändert.

Mehr erfahren

Save the Date oder Einladungskarte?

PLANUNG, VERLOBUNG

"Save the Date"-Benachrichtigung oder Einladungskarte? Oder beides? Wo liegt der Unterschied.

Mehr erfahren

Zum Niederknien: schöne Ideen für eine Ver...

VERLOBUNG

So kreiert Ihr einen unvergesslichen Heiratsantrag:

Mehr erfahren

Der Engagement-Moon: Koffer auf! Liebe rei...

VERLOBUNG

Koffer auf, Gefühle rein und los gehts...

Mehr erfahren

Verlobungsring. Welchen Stein schenke ich ...

VERLOBUNG

Edelsteine sind das Krönchen auf jedem Verlobungs- oder Ehering. Doch welchen wäht man aus? Welche Bedeutung haben die Steinchen? Wir haben einen Überblick:

Mehr erfahren