array( 'name' => __( 'Document Embedder'), 'singular_name' => __( 'Document Embedder' ), 'add_new' => __( 'Add New Doc' ), 'add_new_item' => __( 'Add New Doc' ), 'edit_item' => __( 'Edit' ), 'new_item' => __( 'New item' ), 'view_item' => __( 'View item' ), 'search_items' => __( 'Search'), 'not_found' => __( 'Sorry, we couldn\'t find the power point file you are looking for.' ) ), 'public' => false, 'show_ui' => true, 'publicly_queryable' => true, 'exclude_from_search' => true, 'menu_position' => 14, 'menu_icon' =>PPV_PLUGIN_DIR .'/img/doc.png', 'has_archive' => false, 'hierarchical' => false, 'capability_type' => 'post', 'rewrite' => array( 'slug' => 'ppt_viewer' ), 'supports' => array( 'title' ) ) ); } /*-------------------------------------------------------------------------------*/ /* Metabox /*-------------------------------------------------------------------------------*/ include_once('metabox/meta-box-class/my-meta-box-class.php'); include_once('metabox/class-usage-demo.php'); //include_once('tinymce/ewic-tinymce.php'); /*-------------------------------------------------------------------------------*/ /* Hide & Disabled View, Quick Edit and Preview Button /*-------------------------------------------------------------------------------*/ function ppv_remove_row_actions( $idtions ) { global $post; if( $post->post_type == 'ppt_viewer' ) { unset( $idtions['view'] ); unset( $idtions['inline hide-if-no-js'] ); } return $idtions; } if ( is_admin() ) { add_filter( 'post_row_actions','ppv_remove_row_actions', 10, 2 );} /*-------------------------------------------------------------------------------*/ /* HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button /*-------------------------------------------------------------------------------*/ function ppv_hide_publishing_actions(){ $my_post_type = 'ppt_viewer'; global $post; if($post->post_type == $my_post_type){ echo ' '; } } add_action('admin_head-post.php', 'ppv_hide_publishing_actions'); add_action('admin_head-post-new.php', 'ppv_hide_publishing_actions'); /*-------------------------------------------------------------------------------*/ /* Change publish button to save. /*-------------------------------------------------------------------------------*/ add_filter( 'gettext', 'ppv_change_publish_button', 10, 2 ); function ppv_change_publish_button( $translation, $text ) { if ( 'ppt_viewer' == get_post_type()) if ( $text == 'Publish' ) return 'Save'; return $translation; } // ONLY MOVIE CUSTOM TYPE POSTS add_filter('manage_ppt_viewer_posts_columns', 'ST4_columns_head_only_ppt_viewer', 10); add_action('manage_ppt_viewer_posts_custom_column', 'ST4_columns_content_only_ppt_viewer', 10, 2); // CREATE TWO FUNCTIONS TO HANDLE THE COLUMN function ST4_columns_head_only_ppt_viewer($defaults) { $defaults['directors_name'] = 'ShortCode'; return $defaults; } function ST4_columns_content_only_ppt_viewer($column_name, $post_ID) { if ($column_name == 'directors_name') { // show content of 'directors_name' column echo ''; } } /*-------------------------------------------------------------------------------*/ // sub menu page /*-------------------------------------------------------------------------------*/ add_action('admin_menu', 'ppv_custom_submenu_page'); function ppv_custom_submenu_page() { add_submenu_page( 'edit.php?post_type=ppt_viewer', 'Developer', 'Developer', 'manage_options', 'ppv_submenu_page', 'ppv_submenu_page_callback' ); } function ppv_submenu_page_callback() { echo '
'; echo '

Developer

Md Abu hayat polash

Professional Web Developer (Freelancer)

Web : www.abuhayatpolash.com
Hire Me : www.fiverr.com/abuhayat
Email: abuhayat.du@gmail.com
Skype: ah_polash

'; echo '
'; } //How to use add_action('admin_menu', 'svp_howto_page'); function svp_howto_page() { add_submenu_page( 'edit.php?post_type=ppt_viewer', 'How To Use', 'How To Use', 'manage_options', 'ppv_howto', 'ppv_howto_page_callback' ); } function ppv_howto_page_callback() { echo '
'; echo '

How to use

Watch the video to learn how to use the plugin.


Coming Soon...
'; echo '
'; } /* */ /*-------------------------------------------------------------------------------*/ // Dashboard widget /*-------------------------------------------------------------------------------*/ function ppv_add_dashboard_widgets() { wp_add_dashboard_widget( 'ppv_example_dashboard_widget', 'Support Document Embedder', 'ppv_dashboard_widget_function' ); global $wp_meta_boxes; $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; $example_widget_backup = array( 'ppv_example_dashboard_widget' => $normal_dashboard['ppv_example_dashboard_widget'] ); unset( $normal_dashboard['ppv_example_dashboard_widget'] ); $sorted_dashboard = array_merge( $example_widget_backup, $normal_dashboard ); $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; } function ppv_dashboard_widget_function() { // Display whatever it is you want to show. echo '

It is hard to continue development and support for this plugin without contributions from users like you. If you enjoy using the plugin and find it useful, please consider support by DONATION or BUY THE PRO VERSION (Ad Less) of the Plugin. Your support will help encourage and support the plugin’s continued development and better user support.

Donate Now

';} add_action( 'wp_dashboard_setup', 'ppv_add_dashboard_widgets' ); // Adds a box to the main column on the Post and Page edit screens. function ppv_myplugin_add_meta_box() { add_meta_box( 'donation', __( 'Support Document Embedder', 'myplugin_textdomain' ), 'ppv_callback_donation', 'ppt_viewer' ); add_meta_box( 'myplugin_sectionid', __( 'Try LightBox Addons', 'myplugin_textdomain' ), 'ppv_addons_callback', 'ppt_viewer', 'side' ); add_meta_box( 'myplugin', __( 'Please show some love', 'myplugin_textdomain' ), 'ppv_callback', 'ppt_viewer', 'side' ); } add_action( 'add_meta_boxes', 'ppv_myplugin_add_meta_box' ); function ppv_callback_donation( ) {echo 'If you found this Plugin helpful and wish to support our opensource Project, Then You can DONATE us any amount you want. Donate Now';}; function ppv_addons_callback(){echo'

LightBox Addons enable you to open any doc in a Nice LightBox

See Demo Buy Now
';}; function ppv_callback( ) {echo 'If you like Document Embedder Plugin, please leave us a ★★★★★ rating. Your Review is very important to us as it helps us to grow more.

Need some improvement ? Please let me know how can i improve the Plugin.

';}; // Add Sortcode function ppv_cpt_content_func($atts){ extract( shortcode_atts( array( 'id' => null, ), $atts ) ); $file_url=get_post_meta($id,'_groupped_ppv_file_url', true); $ext_url=get_post_meta($id,'_groupped_ppv_ext_url', true); if (is_array($file_url)){$url=$file_url['url'];}else{$url=$ext_url;} $width=get_post_meta($id,'ppt_ppv_width', true); $height= get_post_meta($id,'ppt_ppv_height', true); if ($width==''){$width='100%';} else{$width=$width.'px';} if ($height==''){$height='600px'; } else {$height=$height.'px';} $frame_style= 'width:'.$width.'; '. 'height:'. $height. ';'; $viewer_type=get_post_meta($id,'ppt_ppv_type', true); if($viewer_type == 'googledocs'){ $base_url = 'https://docs.google.com/gview?embedded=true&url='; }else{ $base_url = 'https://view.officeapps.live.com/op/embed.aspx?src='; } if($url==''){ echo '

Ooops... You forgot to Select a document. Please select a file or paste a external document link to show here.

';} else{ // show file name $file_name=get_post_meta($id,'ppt_ppv_file_name', true); if($file_name=='on'){$file_name=basename($url); echo '
File Name: '.$file_name.'
';} // Download button if(get_post_meta($id,'ppt_ppv_download',true)=='on'){ $down_btn_color= get_post_meta($id,'ppt_ppv_download_btn_color', true); echo '

';} echo ''; } } add_shortcode('doc','ppv_cpt_content_func');