'',
), $atts ) ); ob_start(); ?>
loading="" >
BP3D_VIEWER_PLUGIN_DIR.'public/js/model-viewer.min.js',
'type' => 'module',
)
);
$output = ob_get_clean(); return $output;
}
add_shortcode('3d_viewer','bp3dviewer_cpt_content_func');
// Custom post-type
function bp_3d_viewer(){
$labels = array(
'name' => __( '3D Viewer', 'model-viewer' ),
'menu_name' => __( '3D Viewer', 'model-viewer' ),
'name_admin_bar' => __( '3D Viewer', 'model-viewer' ),
'add_new' => __( 'Add New', 'model-viewer' ),
'add_new_item' => __( 'Add New ', 'model-viewer' ),
'new_item' => __( 'New 3D Viewer ', 'model-viewer' ),
'edit_item' => __( 'Edit 3D Viewer ', 'model-viewer' ),
'view_item' => __( 'View 3D Viewer ', 'model-viewer' ),
'all_items' => __( 'All 3D Viewers', 'model-viewer' ),
'not_found' => __( 'Sorry, we couldn\'t find the Feed you are looking for.' )
);
$args = array(
'labels' => $labels,
'description' => __('3D Viewer Options.', 'model-viewer'),
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-format-image',
'query_var' => true,
'rewrite' => array( 'slug' => 'model-viewer' ),
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'menu_position' => 20,
'supports' => array( 'title'),
);
register_post_type( 'bp3d-model-viewer', $args );
}
add_action( 'init', 'bp_3d_viewer');
// Additional admin style
function bp3d_admin_style(){
wp_register_style( 'bp3d-custom-style', plugin_dir_url( __FILE__ ). 'public/css/custom-style.css');
wp_enqueue_style('bp3d-custom-style');
}
add_action('admin_enqueue_scripts', 'bp3d_admin_style');
// External files Inclusion
require_once 'inc/csf/csf-config.php';
require_once 'inc/csf/metabox-options.php';
// Mimes
require_once 'inc/mimes/enable-mime-type.php';
//
/*-------------------------------------------------------------------------------*/
/* Additional Features
/*-------------------------------------------------------------------------------*/
// Hide & Disabled View, Quick Edit and Preview Button
function bp3d_remove_row_actions( $idtions ) {
global $post;
if( $post->post_type == 'bp3d-model-viewer' ) {
unset( $idtions['view'] );
unset( $idtions['inline hide-if-no-js'] );
}
return $idtions;
}
if ( is_admin() ) {
add_filter( 'post_row_actions','bp3d_remove_row_actions', 10, 2 );}
// HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button
function bp3d_hide_publishing_actions(){
$my_post_type = 'bp3d-model-viewer';
global $post;
if($post->post_type == $my_post_type){
echo '
';
}
}
add_action('admin_head-post.php', 'bp3d_hide_publishing_actions');
add_action('admin_head-post-new.php', 'bp3d_hide_publishing_actions');
/*-------------------------------------------------------------------------------*/
// Remove post update massage and link
/*-------------------------------------------------------------------------------*/
function bp3d_updated_messages( $messages ) {
$messages['bp3d-model-viewer'][1] = __('Shortcode updated ', 'model-viewer');
return $messages;
}
add_filter('post_updated_messages','bp3d_updated_messages');
/*-------------------------------------------------------------------------------*/
/* Change publish button to save.
/*-------------------------------------------------------------------------------*/
add_filter( 'gettext', 'bp3d_change_publish_button', 10, 2 );
function bp3d_change_publish_button( $translation, $text ) {
if ( 'bp3d-model-viewer' == get_post_type())
if ( $text == 'Publish' )
return 'Save';
return $translation;
}
/*-------------------------------------------------------------------------------*/
/* Footer Review Request .
/*-------------------------------------------------------------------------------*/
add_filter( 'admin_footer_text','bp3d_admin_footer');
function bp3d_admin_footer( $text ) {
if ( 'bp3d-model-viewer' == get_post_type() ) {
$url = 'https://wordpress.org/plugins/3d-viewer/reviews/?filter=5#new-post';
$text = sprintf( __( 'If you like 3D Viewer please leave us a ★★★★★ rating. Your Review is very important to us as it helps us to grow more. ', 'model-viewer' ), $url );
}
return $text;
}
/*-------------------------------------------------------------------------------*/
/* Shortcode Generator area .
/*-------------------------------------------------------------------------------*/
add_action('edit_form_after_title','bp3d_shortcode_area');
function bp3d_shortcode_area(){
global $post;
if($post->post_type =='bp3d-model-viewer') : ?>