PATH:
home
/
letacommog
/
chevaldefeu
/
wp-content
/
themes
/
betheme
/
functions
<?php /** * Layout custom meta fields. * * @package Betheme * @author Muffin group * @link https://muffingroup.com */ /** * Create new post type */ if (! function_exists('mfn_layout_post_type')) { function mfn_layout_post_type() { $layout_item_slug = mfn_opts_get('layout-slug', 'layout-item'); $labels = array( 'name' => esc_html__('Layouts', 'mfn-opts'), 'singular_name' => esc_html__('Layout', 'mfn-opts'), 'add_new' => esc_html__('Add New', 'mfn-opts'), 'add_new_item' => esc_html__('Add New Layout', 'mfn-opts'), 'edit_item' => esc_html__('Edit Layout', 'mfn-opts'), 'new_item' => esc_html__('New Layout', 'mfn-opts'), 'view_item' => esc_html__('View Layout', 'mfn-opts'), 'search_items' => esc_html__('Search Layouts', 'mfn-opts'), 'not_found' => esc_html__('No layouts found', 'mfn-opts'), 'not_found_in_trash' => esc_html__('No layouts found in Trash', 'mfn-opts'), ); $args = array( 'labels' => $labels, 'menu_icon' => 'dashicons-edit', 'public' => false, 'show_ui' => true, 'supports' => array( 'title', 'page-attributes' ), ); register_post_type('layout', $args); } } add_action('init', 'mfn_layout_post_type'); /** * Edit columns */ if (! function_exists('mfn_layout_edit_columns')) { function mfn_layout_edit_columns($columns) { $newcolumns = array( 'cb' => '<input type="checkbox" />', 'title' => esc_html__('Title', 'mfn-opts'), 'layout_ID' => esc_html__('Layout ID', 'mfn-opts'), ); $columns = array_merge($newcolumns, $columns); return $columns; } } add_filter('manage_edit-layout_columns', 'mfn_layout_edit_columns'); /** * Custom columns */ if (! function_exists('mfn_layout_custom_columns')) { function mfn_layout_custom_columns($column) { global $post; switch ($column) { case 'layout_ID': echo esc_attr($post->ID); break; } } } add_action('manage_posts_custom_column', 'mfn_layout_custom_columns'); /** * Define Metabox Fields */ $mfn_layout_meta_box = array( 'id' => 'mfn-meta-layout', 'title' => esc_html__('Layout Options', 'mfn-opts'), 'page' => 'layout', 'context' => 'normal', 'priority' => 'high', 'fields' => array( // layout array( 'id' => 'mfn-post-info-layout', 'type' => 'info', 'title' => '', 'desc' => __('Layout', 'mfn-opts'), 'class' => 'mfn-info', ), array( 'id' => 'mfn-post-layout', 'type' => 'radio_img', 'title' => __('Layout', 'mfn-opts'), 'options' => array( 'full-width' => array('title' => 'Full width', 'img' => MFN_OPTIONS_URI.'img/select/style/full-width.png'), 'boxed' => array('title' => 'Boxed', 'img' => MFN_OPTIONS_URI.'img/select/style/boxed.png'), ), 'std' => 'full-width', 'class' => 'wide', ), array( 'id' => 'mfn-post-info-background', 'type' => 'info', 'title' => '', 'desc' => __('Background', 'mfn-opts'), 'class' => 'mfn-info', ), array( 'id' => 'mfn-post-bg', 'type' => 'upload', 'title' => __('Image', 'mfn-opts'), ), array( 'id' => 'mfn-post-bg-pos', 'type' => 'select', 'title' => __('Position', 'mfn-opts'), 'desc' => __('This option can be used only with your custom image selected above', 'mfn-opts'), 'options' => mfna_bg_position(), 'std' => 'center top no-repeat', ), // logo array( 'id' => 'mfn-post-info-logo', 'type' => 'info', 'title' => '', 'desc' => __('Logo', 'mfn-opts'), 'class' => 'mfn-info', ), array( 'id' => 'mfn-post-logo-img', 'type' => 'upload', 'title' => __('Logo', 'mfn-opts'), ), array( 'id' => 'mfn-post-retina-logo-img', 'type' => 'upload', 'title' => __('Retina', 'mfn-opts'), 'desc' => __('Retina Logo should be 2x larger than Custom Logo', 'mfn-opts'), 'sub_desc' => __('optional', 'mfn-opts'), ), array( 'id' => 'mfn-post-sticky-logo-img', 'type' => 'upload', 'title' => __('Sticky Header', 'mfn-opts'), 'sub_desc' => __('optional', 'mfn-opts'), 'desc' => __('Use if you want different logo for Sticky Header', 'mfn-opts'), ), array( 'id' => 'mfn-post-sticky-retina-logo-img', 'type' => 'upload', 'title' => __('Sticky Header Retina', 'mfn-opts'), 'sub_desc' => __('optional', 'mfn-opts'), 'desc' => __('Retina Logo should be 2x larger than Sticky Logo', 'mfn-opts'), ), array( 'id' => 'mfn-post-responsive-logo-img', 'type' => 'upload', 'title' => __('Mobile', 'mfn-opts'), 'sub_desc' => __('<b>< 768px</b><br />optional', 'mfn-opts'), 'desc' => __('Use if you want different logo for Mobile', 'mfn-opts'), ), array( 'id' => 'mfn-post-responsive-retina-logo-img', 'type' => 'upload', 'title' => __('Mobile Retina', 'mfn-opts'), 'sub_desc' => __('optional', 'mfn-opts'), 'desc' => __('Retina Logo should be 2x larger than Mobile Logo', 'mfn-opts'), ), array( 'id' => 'mfn-post-responsive-sticky-logo-img', 'type' => 'upload', 'title' => __('Mobile Sticky Header', 'mfn-opts'), 'sub_desc' => __('<b>< 768px</b><br />optional', 'mfn-opts'), 'desc' => __('Use if you want different logo for Mobile Sticky Header', 'mfn-opts'), ), array( 'id' => 'mfn-post-responsive-sticky-retina-logo-img', 'type' => 'upload', 'title' => __('Mobile Sticky Header Retina', 'mfn-opts'), 'sub_desc' => __('optional', 'mfn-opts'), 'desc' => __('Retina Logo should be 2x larger than Mobile Sticky Header Logo', 'mfn-opts'), ), // header array( 'id' => 'mfn-post-info-header', 'type' => 'info', 'title' => '', 'desc' => __('Header', 'mfn-opts'), 'class' => 'mfn-info', ), array( 'id' => 'mfn-post-header-style', 'type' => 'radio_img', 'title' => __('Style', 'mfn-opts'), 'options' => mfna_header_style(), 'std' => 'modern', 'class' => 'wide', ), array( 'id' => 'mfn-post-minimalist-header', 'type' => 'select', 'title' => __('Minimalist', 'mfn-opts'), 'desc' => __('Header without background image & padding', 'mfn-opts'), 'options' => array( '0' => 'Default | OFF', '1' => 'Minimalist | ON', 'no' => 'Minimalist without Header space', ), ), array( 'id' => 'mfn-post-sticky-header', 'type' => 'switch', 'title' => __('Sticky', 'mfn-opts'), 'options' => array('1' => 'On','0' => 'Off'), 'std' => '1' ), array( 'id' => 'mfn-post-sticky-header-style', 'type' => 'select', 'title' => __('Sticky | Style', 'mfn-opts'), 'options' => array( 'tb-color' => __('The same as Top Bar Left background', 'mfn-opts'), 'white' => __('White', 'mfn-opts'), 'dark' => __('Dark', 'mfn-opts'), ), ), // colors array( 'id' => 'mfn-post-info-colors', 'type' => 'info', 'title' => '', 'desc' => __('Colors', 'mfn-opts'), 'class' => 'mfn-info', ), array( 'id' => 'mfn-post-skin', 'type' => 'select', 'title' => __('Skin', 'mfn-opts'), 'sub_desc' => __('Choose one of the predefined styles or set your own colors', 'mfn-opts'), 'desc' => __('<strong>Important:</strong> Color options can be used only with the <strong>Custom Skin</strong>', 'mfn-opts'), 'options' => mfna_skin(), 'std' => 'custom', ), array( 'id' => 'mfn-post-background-subheader', 'type' => 'color', 'title' => __('Subheader | Background', 'mfn-opts'), 'std' => '#F7F7F7', ), array( 'id' => 'mfn-post-color-subheader', 'type' => 'color', 'title' => __('Subheader | Text color', 'mfn-opts'), 'std' => '#888888', ), ), ); /** * Add metabox to edit page */ if (! function_exists('mfn_layout_meta_add')) { function mfn_layout_meta_add() { global $mfn_layout_meta_box; add_meta_box($mfn_layout_meta_box['id'], $mfn_layout_meta_box['title'], 'mfn_layout_show_box', $mfn_layout_meta_box['page'], $mfn_layout_meta_box['context'], $mfn_layout_meta_box['priority']); } } add_action('admin_menu', 'mfn_layout_meta_add'); /** * Callback function to show fields in meta box */ if (! function_exists('mfn_layout_show_box')) { function mfn_layout_show_box() { global $MFN_Options, $mfn_layout_meta_box, $post; $MFN_Options->_enqueue(); echo '<div id="mfn-wrapper">'; echo '<input type="hidden" name="mfn-builder-nonce" value="', wp_create_nonce('mfn-builder-nonce'), '" />'; echo '<table class="form-table">'; echo '<tbody>'; foreach ($mfn_layout_meta_box['fields'] as $field) { $meta = get_post_meta($post->ID, $field['id'], true); if (! key_exists('std', $field)) { $field['std'] = false; } $meta = ($meta || $meta==='0') ? $meta : stripslashes(htmlspecialchars(($field['std']), ENT_QUOTES)); mfn_meta_field_input($field, $meta); } echo '</tbody>'; echo '</table>'; echo '</div>'; } } /** * Save data when post is edited */ if (! function_exists('mfn_layout_save_data')) { function mfn_layout_save_data($post_id) { global $mfn_layout_meta_box; // verify nonce if (key_exists('mfn-builder-nonce', $_POST)) { if (! wp_verify_nonce($_POST['mfn-builder-nonce'], 'mfn-builder-nonce')) { return $post_id; } } // check autosave if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } // check permissions if ((key_exists('post_type', $_POST)) && ('page' == $_POST['post_type'])) { if (!current_user_can('edit_page', $post_id)) { return $post_id; } } elseif (!current_user_can('edit_post', $post_id)) { return $post_id; } foreach ($mfn_layout_meta_box['fields'] as $field) { $old = get_post_meta($post_id, $field['id'], true); if (key_exists($field['id'], $_POST)) { $new = $_POST[$field['id']]; } else { continue; } if (isset($new) && $new != $old) { update_post_meta($post_id, $field['id'], $new); } elseif ('' == $new && $old) { delete_post_meta($post_id, $field['id'], $old); } } } } add_action('save_post', 'mfn_layout_save_data');
[+]
..
[-] widget-flickr.php
[edit]
[-] class-love.php
[edit]
[-] widget-menu.php
[edit]
[-] meta-template.php
[edit]
[-] theme-menu.php
[edit]
[+]
admin
[-] theme-mega-menu.php
[edit]
[-] widget-login.php
[edit]
[-] meta-client.php
[edit]
[-] meta-offer.php
[edit]
[+]
importer
[-] meta-testimonial.php
[edit]
[-] widget-recent-posts.php
[edit]
[-] widget-recent-comments.php
[edit]
[-] meta-slide.php
[edit]
[-] widget-functions.php
[edit]
[-] widget-tag-cloud.php
[edit]
[-] theme-shortcodes.php
[edit]
[+]
plugins
[-] meta-page.php
[edit]
[-] meta-post.php
[edit]
[+]
builder
[-] meta-portfolio.php
[edit]
[-] meta-layout.php
[edit]
[-] theme-head.php
[edit]
[-] theme-woocommerce.php
[edit]
[-] theme-functions.php
[edit]
[-] theme-hooks.php
[edit]
[+]
tinymce