• I’m trying to make a new plugin. I hope it’s maxim complete. but now I face a problem. When install my custom plugin then the Featured image upload option not working properly. It’s show like a media uploaded http://postimg.org/image/und4s6tdz/ not show like http://postimg.org/image/g5fxk722v/ .

    My custom plugin code give blow .

    <?php
    
    /*
    Plugin Name: ABS Gallery
    Plugin URI: http://www.absiddik.net/
    Description: This plugin will enable accordion in your wordpress theme. You can embed accordion via shortcode in everywhere you want, even in theme files.
    Author: AB Siddik
    Version: 1.0.0
    Author URI: http://www.absiddik.net/
    */
    
    /*
     *Latest Jquery For ABS Gallery Plugin.
     */
    function abs_gallary_latest_jquery() {
        wp_enqueue_script( 'jquery' );
    }
    add_action( 'init', 'abs_gallary_latest_jquery' );
    
    /**
     * Main Jquery and Style for ABS Gallery Plugin,
     */
    function abs_gallery_main_jquery() {
    
    	wp_enqueue_script( 'abs-gallery-boortstrao-js','//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js', array('jquery'), 1.0, false);
    
    	wp_enqueue_script( 'abs-gallery-js', plugins_url( '/js/slick.min.js', __FILE__ ), array('jquery'), 1.0, false);
    
    	wp_enqueue_script( 'abs-gallery-active-js', plugins_url( '/js/active.js', __FILE__ ), array('jquery'), 1.0, false);
    
    	wp_enqueue_style( 'abs-gallery-css', plugins_url( '/css/slick.css', __FILE__ ));
    
    	wp_enqueue_style( 'abs-gallery-theme-css', plugins_url( '/css/slick-theme.css', __FILE__ ));
    
    	wp_enqueue_style( 'abs-prefix-font-awesome', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css', array(), '3.3.4' );
    
    	wp_enqueue_style( 'abs-gallery-main-css', plugins_url( '/css/gallery-plu.css', __FILE__ ));
    }
    
    add_action( 'init', 'abs_gallery_main_jquery' );
    
    /*===== Thumbonial Support for ABS gallery plugin =====*/
    add_theme_support( 'post-thumbnails' );
    
    add_image_size( 'img_slide',400,400, true );
    
    add_image_size( 'img_thum',75,75, true );
    
    include_once('inc/quate-form.php');
    
    /* This sortcode use for Tab Titel */
    function abs_gallery_slide($atts){
    	extract( shortcode_atts( array(
    		'catagory' => '',
    	), $atts, 'gallery' ) );
    
        $q = new WP_Query(
            array('posts_per_page' => -1,'post_type'=> 'absgallery', 'gallery_cat' => $catagory));		
    
    	$list = '<div class="slider-for">';
    	while($q->have_posts()) : $q->the_post();
    
    	$img_slide = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'img_slide' );
    
    		$list .= '
    					<div class="pro_slide">
    						<div class="pro_info">
    							<h2>'.get_the_title().'</h2>
    							<p>'.get_the_content().'</p>
    							<p class="onclick">Popup</p>
    						</div>
    						<div class="pro_img">
    							<img src="'.$img_slide[0].'" alt="" />
    						</div>
    
    					</div>
    				';
    	endwhile;
    	$list.= '</div>';
    	wp_reset_query();
    	return $list;
    }
    add_shortcode('galslide', 'abs_gallery_slide');
    
    /* This sortcode use for Tab Content */
    function abs_gallery_thum($atts){
    	extract( shortcode_atts( array(
    		'catagory' => '',
    	), $atts, 'gallery' ) );
    
        $q = new WP_Query(
            array('posts_per_page' => -1,'post_type'=> 'absgallery', 'gallery_cat' => $catagory));		
    
    	$list = '<div id="adding" class="slider-nav">';
    	while($q->have_posts()) : $q->the_post();
    		$img_thum = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'img_thum' );
    
    		$list .= '
    		<div class="pro_thum">
    			<img src="'.$img_thum[0].'" alt="" />
    		</div>
    		';
    	endwhile;
    	$list.= '</div>';
    	wp_reset_query();
    	return $list;
    }
    add_shortcode('galthum', 'abs_gallery_thum');
    
    /****Main galary *****/
    
    function abs_gallery_main($atts){
    	  $a = shortcode_atts( array(
            'catagory' => '',
        ), $atts );
    
    	return'
    	<div class="row">
    		<div class="col-md-12">
    		'.do_shortcode('[galslide catagory="'.$catagory.'"][galthum catagory="'.$catagory.'"]').'
    		</div>
    	</div>
    	';
    }
    add_shortcode('abs_gallery','abs_gallery_main');
    
    /*This custom post for ABS Gallery*/
    add_action( 'init', 'abs_gallery_custom_post' );
    
    function abs_gallery_custom_post() {
    	$labels = array(
    		'name'               => _x( 'Gallry Item', 'abs-gallery-plu' ),
    		'singular_name'      => _x( 'Gallry Item',  'abs-gallery-plu' ),
    		'menu_name'          => _x( 'Gallry Items', 'abs-gallery-plu' ),
    		'name_admin_bar'     => _x( 'Gallry Item',  'abs-gallery-plu' ),
    		'add_new'            => _x( 'Add New Gallry Item', 'abs-gallery-plu' ),
    		'add_new_item'       => __( 'Add New Gallry Item', 'abs-gallery-plu' ),
    		'new_item'           => __( 'New Gallry Items', 'abs-gallery-plu' ),
    		'edit_item'          => __( 'Edit Gallry Item', 'abs-gallery-plu' ),
    		'view_item'          => __( 'View Gallry Item', 'abs-gallery-plu' ),
    		'all_items'          => __( 'All Gallry Items', 'abs-gallery-plu' ),
    		'search_items'       => __( 'Search Gallry', 'abs-gallery-plu' ),
    		'parent_item_colon'  => __( 'Parent Gallry:', 'abs-gallery-plu' ),
    		'not_found'          => __( 'No Gallry Items found.', 'abs-gallery-plu' ),
    		'not_found_in_trash' => __( 'No Gallry Items found in Trash.', 'abs-gallery-plu' )
    	);
    
    	$args = array(
    		'labels'             => $labels,
    		'public'             => true,
    		'publicly_queryable' => true,
    		'show_ui'            => true,
    		'show_in_menu'       => true,
    		'query_var'          => true,
    		'rewrite'            => array( 'slug' => 'gallery-item' ),
    		'capability_type'    => 'post',
    		'has_archive'        => true,
    		'hierarchical'       => false,
    		'menu_position'      => null,
    		'supports'           => array( 'title','editor','thumbnail')
    	);
    
    	register_post_type( 'absgallery', $args );
    }
    
    /* ----This Code for Woki Item Custom texonomy------*/
    function abs_gallery_custom_post_taxonomy() {
    	register_taxonomy(
    		'gallery_cat',  //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
    		'absgallery',                  //post type name
    		array(
    			'hierarchical'          => true,
    			'label'                         => 'Gallery Catagory',  //Display name
    			'query_var'             => true,
    			'show_admin_column'             => true,
    			'rewrite'                       => array(
    				'slug'                  => 'gallery-cat', // This controls the base slug that will display before each term
    				'with_front'    => true // Don't display the category base before
    				)
    			)
    	);
    
    }
    add_action( 'init', 'abs_gallery_custom_post_taxonomy'); 
    
    ?>

    Anybody can help me what wrong with my code ?

  • The topic ‘Featured image upload option not working properly?’ is closed to new replies.