Sid Gifari File Manager
🏠 Root
/
home
/
ailwtbdh
/
public_html
/
wp-content
/
plugins
/
profundcore
/
metabox
/
Editing: metabox.php
<?php add_action( 'cmb2_admin_init', 'profund_register_post_metabox' ); function profund_register_post_metabox() { $prefix = '_profund_'; /*-- Page-Meta-Box-Fields --*/ $CampMetaBox = new_cmb2_box(array( 'id' => $prefix . 'campaign_meta_options', 'title' => esc_html__('Campaign Options', 'profundcore' ), 'object_types' => array( 'campaign' ) )); $CampMetaBox->add_field(array( 'name' => esc_html__('Author Name', 'profundcore' ), 'id' => $prefix . 'camp_author_name', 'type' => 'text', 'desc' => esc_html__('What is the name of the project leader.', 'profundcore' ) )); $CampMetaBox->add_field(array( 'name' => __( 'Author Picture','profundcore' ), 'id' => $prefix . 'camp_author_photo', 'type' => 'file', 'desc' => esc_html__('What is the name of the project leader.', 'profundcore' ), 'text' => array( 'add_upload_file_text' => __( 'Add Picture','profundcore' ), ), 'query_args' => array( 'type' => array( 'image/gif', 'image/jpeg', 'image/png', ), ), 'preview_size' => 'thumbnail', )); $CampMetaBox->add_field( array( 'name' => __( 'Project Progress','profundcore' ), 'id' => $prefix . 'camp_progress', 'type' => 'text', 'default' => 0, 'attributes' => array( 'type' => 'number', 'min' => '0', 'max' => '100', ), ) ); $CampMetaBox->add_field(array( 'name' => esc_html__('Raised', 'profundcore' ), 'id' => $prefix . 'camp_raised', 'type' => 'text', )); $CampMetaBox->add_field(array( 'name' => esc_html__('Days to Go', 'profundcore' ), 'id' => $prefix . 'camp_day', 'type' => 'text', )); $CampMetaBox->add_field(array( 'name' => esc_html__('Pledged', 'profundcore' ), 'id' => $prefix . 'camp_pledged', 'type' => 'text', )); /*-- Page-Meta-Box-Fields --*/ $profund_page_meta = new_cmb2_box(array( 'id' => $prefix . 'page_options', 'title' => esc_html__('Page Options', 'profundcore' ), 'object_types' => array( 'page' ) )); $profund_page_meta->add_field(array( 'name' => esc_html__('Onepage Template:', 'profundcore' ), 'id' => $prefix . 'one_page_template', 'type' => 'checkbox', 'desc' => esc_html__('Will this page use as a onepage template?', 'profundcore' ) )); $profund_page_meta->add_field(array( 'name' => esc_html__('Onepage Scroll', 'profundcore' ), 'id' => $prefix . 'one_page_scroll', 'type' => 'checkbox', 'desc' => esc_html__('To get a id selected scroll?', 'profundcore' ) )); $profund_page_meta->add_field(array( 'name' => esc_html__('Remove Page Header:', 'profundcore' ), 'id' => $prefix . 'page_header', 'type' => 'checkbox', 'desc' => esc_html__('Check this field if you want remove page header on this page.', 'profundcore' ) )); $profund_page_meta->add_field(array( 'name' => esc_html__('Transparent Menu:', 'profundcore' ), 'id' => $prefix . 'transparent_menu', 'type' => 'checkbox', 'desc' => esc_html__('Check this field if you want transparent menu on this page.', 'profundcore' ) )); $profund_page_meta->add_field(array( 'name' => esc_html__('Remove Footer Area:', 'profundcore' ), 'id' => $prefix . 'footer_widget', 'type' => 'checkbox', 'desc' => esc_html__('Check this field if you want remove footer widgets on this page.', 'profundcore' ) )); /*-- Post-Meta-Box-Content --*/ $profund_post_meta = new_cmb2_box( array( 'id' => $prefix.'post_metabox', 'title' => esc_html__('Additional Fields', 'profundcore' ), 'object_types' => array( 'post' ), // post type ) ); $profund_post_meta->add_field( array( 'name' => esc_html__( 'Photo Gallery', 'profundcore' ), 'desc' => esc_html__( 'This field for gallery images. This gallery show for select gallery format.', 'profundcore' ), 'id' => $prefix . 'post_gallery', 'type' => 'file_list', 'text' => array( 'add_upload_files_text' => esc_html__('Add images', 'profundcore' ), // default: "Add or Upload Files" ), ) ); $profund_post_meta->add_field( array( 'name' => esc_html__('Embed Video', 'profundcore' ), 'desc' => esc_html__('Enter a youtube, twitter, or instagram URL. Supports services listed at ', 'profundcore' ).'<a href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a> '.esc_html__('This video show for select video format', 'profundcore' ), 'id' => $prefix . 'post_video_embed', 'type' => 'oembed', ) ); $profund_post_meta->add_field( array( 'name' => esc_html__('Embed Audio', 'profundcore' ), 'desc' => esc_html__('Enter a SoundCloud, Mixcloud, or ReverbNation etc URL. Supports services listed at ', 'profundcore' ).'<a href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a> '.esc_html__('This audio show for select audio format', 'profundcore' ), 'id' => $prefix . 'post_audio_embed', 'type' => 'oembed', ) ); } if( !function_exists("profund_gallery_photo_list") ){ function profund_gallery_photo_list( $gallery_images, $img_size = 'profund_blog_thumb' ) { if( empty($gallery_images) ){ return false; } // Get the list of gallery $data = '<div class="photo-slider post-media">'; // Loop through them and output an image foreach ( (array) $gallery_images[0] as $image_id => $image_url ) { $data .= '<div class="gallery-item" >'; $data .= wp_get_attachment_image( $image_id, $img_size ); $data .= '</div>'; } $data .= '</div>'; return $data; } } if( !function_exists('profund_video_embed_content') ){ function profund_video_embed_content($post_video_embed_url){ if( empty($post_video_embed_url) ){ return false; } ob_start(); ?> <div class="post-media video-post"> <button type="button" class="video-play-bttn"><i class="fa fa-play"></i></button> <?php $video_url = wp_oembed_get( esc_url($post_video_embed_url) ); echo str_replace( 'src','data-src', $video_url ); ?> <div class="videoPoster" style="background-image: url('<?php echo get_the_post_thumbnail_url('','full'); ?>');"></div> </div> <?php $data = ob_get_contents(); ob_end_clean(); return $data; } } if( !function_exists('profund_audio_embed_content') ){ function profund_audio_embed_content($post_audio_embed_url){ if( empty($post_audio_embed_url) ){ return false; } return '<div class="post-media audio-post">'.wp_oembed_get( $post_audio_embed_url ).'</div>'; } } if(!function_exists('profund_admin_print_script')){ function profund_admin_print_script(){ if( get_post_type() == 'post' ): ?> <script type="text/javascript"> (function($) { "use strict"; $(document).on('ready', function() { $('.cmb2-postbox .cmb-row').css({ 'border-bottom': 'none', 'margin-bottom': '0' }); $('#_profund_post_metabox').hide(0); $('.cmb2-id--profund-post-gallery').hide(0); $('.cmb2-id--profund-post-video-embed').hide(0); $('.cmb2-id--profund-post-audio-embed').hide(0); var id = $('input[name="post_format"]:checked').attr('id'); if (id == 'post-format-gallery') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-gallery').show(); } else { $('.cmb2-id--profund-post-gallery').hide(); } if (id == 'post-format-video') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-video-embed').show(); } else { $('.cmb2-id--profund-post-video-embed').hide(); } if (id == 'post-format-audio') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-audio-embed').show(); } else { $('.cmb2-id--profund-post-audio-embed').hide(); } $('#post-formats-select .post-format').on('change', function() { $('#_profund_post_metabox').hide(0); $('.cmb2-id--profund-post-gallery').hide(0); $('.cmb2-id--profund-post-video-embed').hide(0); $('.cmb2-id--profund-post-audio-embed').hide(0); var id = $('input[name="post_format"]:checked').attr('id'); if (id == 'post-format-gallery') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-gallery').show(); } else { $('.cmb2-id--profund-post-gallery').hide(); } if (id == 'post-format-video') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-video-embed').show(); } else { $('.cmb2-id--profund-post-video-embed').hide(); } if (id == 'post-format-audio') { $('#_profund_post_metabox').show(0); $('.cmb2-id--profund-post-audio-embed').show(); } else { $('.cmb2-id--profund-post-audio-embed').hide(); } }); }); }(jQuery)); </script> <?php endif; } } add_action( 'admin_print_scripts', 'profund_admin_print_script',1000 );
Save
Cancel