/** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Admin * @author StudioPress * @license GPL-2.0+ * @link https://my.studiopress.com/themes/genesis/ */ /** * Term meta defaults. * * @since 2.2.6 * * @return array Default term meta values. */ function genesis_term_meta_defaults() { return apply_filters( 'genesis_term_meta_defaults', array( 'headline' => '', 'intro_text' => '', 'display_title' => 0, // Vestigial. 'display_description' => 0, // Vestigial. 'doctitle' => '', 'description' => '', 'keywords' => '', 'layout' => '', 'noindex' => 0, 'nofollow' => 0, 'noarchive' => 0, ) ); } add_action( 'admin_init', 'genesis_add_taxonomy_archive_options' ); /** * Add the archive options to each custom taxonomy edit screen. * * @since 1.6.0 * * @see genesis_taxonomy_archive_options() Callback for headline and introduction fields. */ function genesis_add_taxonomy_archive_options() { foreach ( get_taxonomies( array( 'public' => true, ) ) as $tax_name ) { add_action( $tax_name . '_edit_form', 'genesis_taxonomy_archive_options', 10, 2 ); } } /** * Echo headline and introduction fields on the taxonomy term edit form. * * If populated, the values saved in these fields may display on taxonomy archives. * * @since 1.6.0 * * @see genesis_add_taxonomy_archive_options() Callback caller. * * @param \stdClass $tag Term object. * @param string $taxonomy Name of the taxonomy. */ function genesis_taxonomy_archive_options( $tag, $taxonomy ) { genesis_meta_boxes()->show_meta_box( 'genesis-term-meta-settings', $tag ); } add_action( 'admin_init', 'genesis_add_taxonomy_seo_options' ); /** * Add the SEO options to each custom taxonomy edit screen. * * @since 1.3.0 * * @see genesis_taxonomy_seo_options() Callback for SEO fields. */ function genesis_add_taxonomy_seo_options() { foreach ( get_taxonomies( array( 'public' => true, ) ) as $tax_name ) { add_action( $tax_name . '_edit_form', 'genesis_taxonomy_seo_options', 10, 2 ); } } /** * Echo title, description, keywords and robots meta SEO fields on the taxonomy term edit form. * * If populated, the values saved in these fields may be used on taxonomy archives. * * @since 1.2.0 * * @see genesis_add-taxonomy_seo_options() Callback caller. * * @param \stdClass $tag Term object. * @param string $taxonomy Name of the taxonomy. */ function genesis_taxonomy_seo_options( $tag, $taxonomy ) { genesis_meta_boxes()->show_meta_box( 'genesis-term-meta-seo', $tag ); } add_action( 'admin_init', 'genesis_add_taxonomy_layout_options' ); /** * Add the layout options to each custom taxonomy edit screen. * * @since 1.4.0 * * @see genesis_taxonomy_layout_options() Callback for layout selector. */ function genesis_add_taxonomy_layout_options() { if ( ! current_theme_supports( 'genesis-archive-layouts' ) ) { return; } if ( ! genesis_has_multiple_layouts() ) { return; } foreach ( get_taxonomies( array( 'public' => true, ) ) as $tax_name ) { add_action( $tax_name . '_edit_form', 'genesis_taxonomy_layout_options', 10, 2 ); } } /** * Echo the layout options on the taxonomy term edit form. * * @since 1.4.0 * * @see genesis_add_taxonomy_layout_options() Callback caller. * * @param \stdClass $tag Term object. * @param string $taxonomy Name of the taxonomy. */ function genesis_taxonomy_layout_options( $tag, $taxonomy ) { genesis_meta_boxes()->show_meta_box( 'genesis-term-meta-layout', $tag ); } add_filter( 'get_term', 'genesis_get_term_filter', 10, 2 ); /** * For backward compatibility only. * * Sets $term->meta to empty array. All calls to $term->meta->key will be unset unless force set by `genesis_term_meta` filter. * * @since 1.2.0 * * @param object $term Database row object. * @param string $taxonomy Taxonomy name that $term is part of. * @return object Database row object. */ function genesis_get_term_filter( $term, $taxonomy ) { // Do nothing, if $term is not object. if ( ! is_object( $term ) ) { return $term; } // Do nothing, if called in the context of creating a term via an ajax call. if ( did_action( 'wp_ajax_add-tag' ) ) { return $term; } // Still set $term->meta and apply filter, for backward compatibility. $term->meta = apply_filters( 'genesis_term_meta', array(), $term, $taxonomy ); return $term; } add_filter( 'get_terms', 'genesis_get_terms_filter', 10, 2 ); /** * Add Genesis term-meta data to functions that return multiple terms. * * @since 2.0.0 * * @param array $terms Database row objects. * @param string $taxonomy Taxonomy name that $terms are part of. * @return array Database row objects. */ function genesis_get_terms_filter( array $terms, $taxonomy ) { foreach ( $terms as $key => $term ) { $terms[ $key ] = genesis_get_term_filter( $term, $taxonomy ); } return $terms; } add_filter( 'get_term_metadata', 'genesis_term_meta_filter', 10, 4 ); /** * Maintain backward compatibility with the older `genesis_term_meta_{$key}` filter so old filter functions will still work. * * @since 2.3.0 * * @param string|array $value The term meta value. * @param int $object_id The term ID. * @param string $meta_key Meta key. * @param bool $single Whether to return only the first value of the specified $meta_key. * @return mixed Filtered term meta value. */ function genesis_term_meta_filter( $value, $object_id, $meta_key, $single ) { return apply_filters( "genesis_term_meta_{$meta_key}", $value, get_term_field( 'slug', $object_id ), null ); } add_action( 'edit_term', 'genesis_term_meta_save', 10, 2 ); /** * Save term meta data. * * Fires when a user edits and saves a term. * * @since 1.2.0 * * @param int $term_id Term ID. * @param int $tt_id Term Taxonomy ID. */ function genesis_term_meta_save( $term_id, $tt_id ) { if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { return; } $values = isset( $_POST['genesis-meta'] ) ? (array) $_POST['genesis-meta'] : array(); $values = wp_parse_args( $values, genesis_term_meta_defaults() ); if ( isset( $values['archive_description'] ) && ! current_user_can( 'unfiltered_html' ) ) { $values['archive_description'] = genesis_formatting_kses( $values['archive_description'] ); } foreach ( $values as $key => $value ) { update_term_meta( $term_id, $key, $value ); } } add_action( 'delete_term', 'genesis_term_meta_delete', 10, 2 ); /** * Delete term meta data. * * Fires when a user deletes a term. * * @since 1.2.0 * * @param int $term_id Term ID. * @param int $tt_id Taxonomy Term ID. */ function genesis_term_meta_delete( $term_id, $tt_id ) { foreach ( genesis_term_meta_defaults() as $key => $value ) { delete_term_meta( $term_id, $key ); } } add_action( 'split_shared_term', 'genesis_split_shared_term' ); /** * Create new term meta record for split terms. * * When WordPress splits terms, ensure that the term meta gets preserved for the newly created term. * * @since 2.2.0 * * @param int $old_term_id The ID of the term being split. * @param int $new_term_id The ID of the newly created term. */ function genesis_split_shared_term( $old_term_id, $new_term_id ) { $term_meta = (array) get_option( 'genesis-term-meta' ); if ( ! isset( $term_meta[ $old_term_id ] ) ) { return; } $term_meta[ $new_term_id ] = $term_meta[ $old_term_id ]; update_option( 'genesis-term-meta', $term_meta ); } /** * Genesis Framework. * * WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances. * Please do all modifications in the form of a child theme. * * @package Genesis\Admin * @author StudioPress * @license GPL-2.0+ * @link https://my.studiopress.com/themes/genesis/ */ add_filter( 'user_contactmethods', 'genesis_user_contactmethods' ); /** * Filter the contact methods registered for users. * * Currently just adds a Google+ field. * * @since 1.9.0 * * @param array $contactmethods Array of contact methods. * @return array Contact methods. */ function genesis_user_contactmethods( array $contactmethods ) { $contactmethods['googleplus'] = __( 'Google+', 'genesis' ); return $contactmethods; } add_action( 'show_user_profile', 'genesis_user_options_fields' ); add_action( 'edit_user_profile', 'genesis_user_options_fields' ); /** * Add fields for user permissions for Genesis features to the user edit screen. * * Checkbox settings are: * * * Enable Genesis Admin Menu? * * Enable SEO Settings Submenu? * * Enable Import/Export Submenu? * * @since 1.4.0 * * @param \WP_User $user User object. * @return void Return early if current user can not edit users. */ function genesis_user_options_fields( $user ) { if ( current_user_can( 'edit_users', $user->ID ) ) { genesis_meta_boxes()->show_meta_box( 'genesis-user-settings', $user ); } } add_action( 'show_user_profile', 'genesis_user_archive_fields' ); add_action( 'edit_user_profile', 'genesis_user_archive_fields' ); /** * Add fields for author archives contents to the user edit screen. * * Input / Textarea fields are: * * * Custom Archive Headline * * Custom Description Text * * Checkbox fields are: * * * Enable Author Box on this User's Posts? * * Enable Author Box on this User's Archives? * * @since 1.6.0 * * @param \WP_User $user User object. * @return void Return early if current user can not edit users. */ function genesis_user_archive_fields( $user ) { if ( current_user_can( 'edit_users', $user->ID ) ) { genesis_meta_boxes()->show_meta_box( 'genesis-user-author', $user ); } } add_action( 'show_user_profile', 'genesis_user_seo_fields' ); add_action( 'edit_user_profile', 'genesis_user_seo_fields' ); /** * Add fields for author archive SEO to the user edit screen. * * Input / Textarea fields are: * * * Custom Document Title * * Meta Description * * Meta Keywords * * Checkbox fields are: * * * Apply noindex to this archive? * * Apply nofollow to this archive? * * Apply noarchive to this archive? * * @since 1.4.0 * * @param \WP_User $user User object. * @return void Return early if current user can not edit users. */ function genesis_user_seo_fields( $user ) { if ( current_user_can( 'edit_users', $user->ID ) ) { genesis_meta_boxes()->show_meta_box( 'genesis-user-seo', $user ); } } add_action( 'show_user_profile', 'genesis_user_layout_fields' ); add_action( 'edit_user_profile', 'genesis_user_layout_fields' ); /** * Add author archive layout selector to the user edit screen. * * @since 1.4.0 * * @param \WP_User $user User object. * * @return void Return early if current theme does not support `genesis-archive-layouts`, or Genesis * does not have multiple layouts, or if current user can not edit users. */ function genesis_user_layout_fields( $user ) { if ( ! current_theme_supports( 'genesis-archive-layouts' ) || ! genesis_has_multiple_layouts() ) { return; } if ( current_user_can( 'edit_users', $user->ID ) ) { genesis_meta_boxes()->show_meta_box( 'genesis-user-layout', $user ); } } add_action( 'personal_options_update', 'genesis_user_meta_save' ); add_action( 'edit_user_profile_update', 'genesis_user_meta_save' ); /** * Update user meta when user edit page is saved. * * @since 1.4.0 * * @param int $user_id User ID. * @return void Return early if current user can not edit users, or no meta fields submitted. */ function genesis_user_meta_save( $user_id ) { if ( ! current_user_can( 'edit_users', $user_id ) ) { return; } if ( ! isset( $_POST['genesis-meta'] ) || ! is_array( $_POST['genesis-meta'] ) ) { return; } $defaults = array( 'genesis_admin_menu' => '', 'genesis_seo_settings_menu' => '', 'genesis_import_export_menu' => '', 'genesis_author_box_single' => '', 'genesis_author_box_archive' => '', 'headline' => '', 'intro_text' => '', 'doctitle' => '', 'meta_description' => '', 'meta_keywords' => '', 'noindex' => '', 'nofollow' => '', 'noarchive' => '', 'layout' => '', ); /** * Filter the user meta defaults array. * * Allows developer to filter the default array of user meta key => value pairs. * * @since 2.1.0 * * @param array $defaults Default user meta array. */ $defaults = apply_filters( 'genesis_user_meta_defaults', $defaults ); $meta = wp_parse_args( $_POST['genesis-meta'], $defaults ); $meta['headline'] = strip_tags( $meta['headline'] ); $meta['intro_text'] = current_user_can( 'unfiltered_html' ) ? $meta['intro_text'] : genesis_formatting_kses( $meta['intro_text'] ); foreach ( $meta as $key => $value ) { update_user_meta( $user_id, $key, $value ); } } add_filter( 'get_the_author_genesis_admin_menu', 'genesis_user_meta_default_on', 10, 2 ); add_filter( 'get_the_author_genesis_seo_settings_menu', 'genesis_user_meta_default_on', 10, 2 ); add_filter( 'get_the_author_genesis_import_export_menu', 'genesis_user_meta_default_on', 10, 2 ); /** * Check to see if user data has actually been saved, or if defaults need to be forced. * * This filter is useful for user options that need to be "on" by default, but keeps us from having to push defaults * into the database, which would be a very expensive task. * * @since 1.4.0 * * @global bool|object authordata User object if successful, false if not. * * @param string|bool $value The submitted value. * @param int $user_id User ID. * @return mixed|int Submitted value, user field value, or `1`. */ function genesis_user_meta_default_on( $value, $user_id ) { // If a real value exists, simply return it. if ( $value ) { return $value; } // Get the name of the field by removing the prefix from the active filter. $field = str_replace( 'get_the_author_', '', current_filter() ); // Setup user data. if ( ! $user_id ) { global $authordata; } else { $authordata = get_userdata( $user_id ); } // Just in case. $user_field = "user_$field"; if ( isset( $authordata->$user_field ) ) { return $authordata->user_field; } // If an empty or false value exists, return it. if ( isset( $authordata->$field ) ) { return $value; } // If all that fails, default to true. return 1; } add_filter( 'get_the_author_genesis_author_box_single', 'genesis_author_box_single_default_on', 10, 2 ); /** * Conditionally force a default 1 value for each users' author box setting. * * @since 1.4.0 * * @param string $value Submitted value. * @param int $user_id User ID. * @return mixed Existing user meta value, or `1`. */ function genesis_author_box_single_default_on( $value, $user_id ) { if ( genesis_get_option( 'author_box_single' ) ) { return genesis_user_meta_default_on( $value, $user_id ); } else { return $value; } } Log In ‹ M S Accounts — WordPress

M S Accounts

ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.

← Back to M S Accounts