Adding Featured Image in Post Listfilter the_content, custom post type, and wp_querywordpress content .php file in an iframe's src in a wordpress postAdding custom image sizes and post types to a plugin or to a theme?How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested LoopHow do I convince this button to do something when it is clicked?Preview featured image using frontend post pluginmanage_posts_custom_column, showing serial number using increment in loopCustom Pin it button is not showing over the image instead it shows as block top_leftcustom post type not showing in menuLooping through image object using ACF and CPT UI [SOLVED]

What favor did Moody owe Dumbledore?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Why are there no stars visible in cislunar space?

Recruiter wants very extensive technical details about all of my previous work

Should I use acronyms in dialogues before telling the readers what it stands for in fiction?

Variable completely messes up echoed string

Calculate the frequency of characters in a string

Why is there so much iron?

Is it insecure to send a password in a `curl` command?

Hausdorff dimension of the boundary of fibres of Lipschitz maps

Do US professors/group leaders only get a salary, but no group budget?

Violin - Can double stops be played when the strings are not next to each other?

How to define limit operations in general topological spaces? Are nets able to do this?

Unfrosted light bulb

Pronounciation of the combination "st" in spanish accents

What is the English word for a graduation award?

Is there a term for accumulated dirt on the outside of your hands and feet?

Comment Box for Substitution Method of Integrals

Why didn't Héctor fade away after this character died in the movie Coco?

Help prove this basic trig identity please!

Optimising a list searching algorithm

Print a physical multiplication table

Using Past-Perfect interchangeably with the Past Continuous

How to terminate ping <dest> &



Adding Featured Image in Post List


filter the_content, custom post type, and wp_querywordpress content .php file in an iframe's src in a wordpress postAdding custom image sizes and post types to a plugin or to a theme?How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested LoopHow do I convince this button to do something when it is clicked?Preview featured image using frontend post pluginmanage_posts_custom_column, showing serial number using increment in loopCustom Pin it button is not showing over the image instead it shows as block top_leftcustom post type not showing in menuLooping through image object using ACF and CPT UI [SOLVED]













2















Adding Featured Image after getting inside of the post is not that hard. But some people want it to do that outside the loop. So is there a way to add a button on post columns to add a featured image in the post list without going inside the post and doing it like the old ways?? It's a simple thing but it may be hard to code. Maybe with AJAX, it can be done.










share|improve this question


























    2















    Adding Featured Image after getting inside of the post is not that hard. But some people want it to do that outside the loop. So is there a way to add a button on post columns to add a featured image in the post list without going inside the post and doing it like the old ways?? It's a simple thing but it may be hard to code. Maybe with AJAX, it can be done.










    share|improve this question
























      2












      2








      2


      1






      Adding Featured Image after getting inside of the post is not that hard. But some people want it to do that outside the loop. So is there a way to add a button on post columns to add a featured image in the post list without going inside the post and doing it like the old ways?? It's a simple thing but it may be hard to code. Maybe with AJAX, it can be done.










      share|improve this question














      Adding Featured Image after getting inside of the post is not that hard. But some people want it to do that outside the loop. So is there a way to add a button on post columns to add a featured image in the post list without going inside the post and doing it like the old ways?? It's a simple thing but it may be hard to code. Maybe with AJAX, it can be done.







      plugins plugin-development






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 16 hours ago









      Ayush O' LeeAyush O' Lee

      113




      113




















          2 Answers
          2






          active

          oldest

          votes


















          1














          I've used the plugin Admin Columns Pro for this — in addition to many useful & time-saving features, it allows you to add a column to the Posts list (or any post type list) showing the featured image. If you set it up to allow inline editing for that column, you can add the featured image directly from the list view. It's saved me loads of time, and clients find it easy to use too.



          Screenshot of Posts view with Admin Column Pro featured image column allowing inline editing.






          share|improve this answer








          New contributor




          Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.



























            1














            Yes, it can be done very easily. There is a great tutorial by Misha Rudrastyh on how to add Featured Images to Quick Edit. I recently applied it and can confirm that it works. You will be able to see the featured images in the admin area post lists and easily change them using Quick Edit. It is a very good alternative to using a plugin.



            Copy and paste the following to your functions.php file:



            /*
            *
            * Add Featured Image Column to Admin Area and Quick Edit menu
            * Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html
            *
            */

            /*
            * This action hook allows to add a new empty column
            */
            add_filter('manage_post_posts_columns', 'misha_featured_image_column');
            function misha_featured_image_column( $column_array )

            // I want to add my column at the beginning, so I use array_slice()
            // in other cases $column_array['featured_image'] = 'Featured Image' will be enough
            $column_array = array_slice( $column_array, 0, 1, true )
            + array('featured_image' => 'Featured Image') // our new column for featured images
            + array_slice( $column_array, 1, NULL, true );

            return $column_array;


            /*
            * This hook will fill our column with data
            */
            add_action('manage_posts_custom_column', 'misha_render_the_column', 10, 2);
            function misha_render_the_column( $column_name, $post_id )

            if( $column_name == 'featured_image' )

            // if there is no featured image for this post, print the placeholder
            if( has_post_thumbnail( $post_id ) )

            // I know about get_the_post_thumbnail() function but we need data-id attribute here
            $thumb_id = get_post_thumbnail_id( $post_id );
            echo '<img data-id="' . $thumb_id . '" src="' . wp_get_attachment_url( $thumb_id ) . '" />';

            else

            // data-id should be "-1" I will explain below
            echo '<img data-id="-1" src="' . get_stylesheet_directory_uri() . '/placeholder.png" />';







            add_action( 'admin_head', 'misha_custom_css' );
            function misha_custom_css()

            echo '<style>
            #featured_image
            width:120px;

            td.featured_image.column-featured_image img
            max-width: 100%;
            height: auto;


            /* some styles to make Quick Edit meny beautiful */
            #misha_featured_image .titlemargin-top:10px;display:block;
            #misha_featured_image a.misha_upload_featured_image
            display:inline-block;
            margin:10px 0 0;

            #misha_featured_image img
            display:block;
            max-width:200px !important;
            height:auto;

            #misha_featured_image .misha_remove_featured_image
            display:none;

            </style>';



            add_action( 'admin_enqueue_scripts', 'misha_include_myuploadscript' );
            function misha_include_myuploadscript()
            if ( ! did_action( 'wp_enqueue_media' ) )
            wp_enqueue_media();



            add_action('quick_edit_custom_box', 'misha_add_featured_image_quick_edit', 10, 2);
            function misha_add_featured_image_quick_edit( $column_name, $post_type )

            // add it only if we have featured image column
            if ($column_name != 'featured_image') return;

            // we add #misha_featured_image to use it in JavaScript in CSS
            echo '<fieldset id="misha_featured_image" class="inline-edit-col-left">
            <div class="inline-edit-col">
            <span class="title">Featured Image</span>
            <div>
            <a href="#" class="misha_upload_featured_image">Set featured image</a>
            <input type="hidden" name="_thumbnail_id" value="" />
            <a href="#" class="misha_remove_featured_image">Remove Featured Image</a>
            </div>
            </div></fieldset>';

            // please look at _thumbnail_id as a name attribute - I use it to skip save_post action



            add_action('admin_footer', 'misha_quick_edit_js_update');
            function misha_quick_edit_js_update()


            If you want more details on how this works and what each part of code does, refer to the tutorial by Misha Rudrastyh.






            share|improve this answer






















              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "110"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f331865%2fadding-featured-image-in-post-list%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I've used the plugin Admin Columns Pro for this — in addition to many useful & time-saving features, it allows you to add a column to the Posts list (or any post type list) showing the featured image. If you set it up to allow inline editing for that column, you can add the featured image directly from the list view. It's saved me loads of time, and clients find it easy to use too.



              Screenshot of Posts view with Admin Column Pro featured image column allowing inline editing.






              share|improve this answer








              New contributor




              Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.
























                1














                I've used the plugin Admin Columns Pro for this — in addition to many useful & time-saving features, it allows you to add a column to the Posts list (or any post type list) showing the featured image. If you set it up to allow inline editing for that column, you can add the featured image directly from the list view. It's saved me loads of time, and clients find it easy to use too.



                Screenshot of Posts view with Admin Column Pro featured image column allowing inline editing.






                share|improve this answer








                New contributor




                Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                  1












                  1








                  1







                  I've used the plugin Admin Columns Pro for this — in addition to many useful & time-saving features, it allows you to add a column to the Posts list (or any post type list) showing the featured image. If you set it up to allow inline editing for that column, you can add the featured image directly from the list view. It's saved me loads of time, and clients find it easy to use too.



                  Screenshot of Posts view with Admin Column Pro featured image column allowing inline editing.






                  share|improve this answer








                  New contributor




                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  I've used the plugin Admin Columns Pro for this — in addition to many useful & time-saving features, it allows you to add a column to the Posts list (or any post type list) showing the featured image. If you set it up to allow inline editing for that column, you can add the featured image directly from the list view. It's saved me loads of time, and clients find it easy to use too.



                  Screenshot of Posts view with Admin Column Pro featured image column allowing inline editing.







                  share|improve this answer








                  New contributor




                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 14 hours ago









                  ChristinaChristina

                  113




                  113




                  New contributor




                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Christina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.























                      1














                      Yes, it can be done very easily. There is a great tutorial by Misha Rudrastyh on how to add Featured Images to Quick Edit. I recently applied it and can confirm that it works. You will be able to see the featured images in the admin area post lists and easily change them using Quick Edit. It is a very good alternative to using a plugin.



                      Copy and paste the following to your functions.php file:



                      /*
                      *
                      * Add Featured Image Column to Admin Area and Quick Edit menu
                      * Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html
                      *
                      */

                      /*
                      * This action hook allows to add a new empty column
                      */
                      add_filter('manage_post_posts_columns', 'misha_featured_image_column');
                      function misha_featured_image_column( $column_array )

                      // I want to add my column at the beginning, so I use array_slice()
                      // in other cases $column_array['featured_image'] = 'Featured Image' will be enough
                      $column_array = array_slice( $column_array, 0, 1, true )
                      + array('featured_image' => 'Featured Image') // our new column for featured images
                      + array_slice( $column_array, 1, NULL, true );

                      return $column_array;


                      /*
                      * This hook will fill our column with data
                      */
                      add_action('manage_posts_custom_column', 'misha_render_the_column', 10, 2);
                      function misha_render_the_column( $column_name, $post_id )

                      if( $column_name == 'featured_image' )

                      // if there is no featured image for this post, print the placeholder
                      if( has_post_thumbnail( $post_id ) )

                      // I know about get_the_post_thumbnail() function but we need data-id attribute here
                      $thumb_id = get_post_thumbnail_id( $post_id );
                      echo '<img data-id="' . $thumb_id . '" src="' . wp_get_attachment_url( $thumb_id ) . '" />';

                      else

                      // data-id should be "-1" I will explain below
                      echo '<img data-id="-1" src="' . get_stylesheet_directory_uri() . '/placeholder.png" />';







                      add_action( 'admin_head', 'misha_custom_css' );
                      function misha_custom_css()

                      echo '<style>
                      #featured_image
                      width:120px;

                      td.featured_image.column-featured_image img
                      max-width: 100%;
                      height: auto;


                      /* some styles to make Quick Edit meny beautiful */
                      #misha_featured_image .titlemargin-top:10px;display:block;
                      #misha_featured_image a.misha_upload_featured_image
                      display:inline-block;
                      margin:10px 0 0;

                      #misha_featured_image img
                      display:block;
                      max-width:200px !important;
                      height:auto;

                      #misha_featured_image .misha_remove_featured_image
                      display:none;

                      </style>';



                      add_action( 'admin_enqueue_scripts', 'misha_include_myuploadscript' );
                      function misha_include_myuploadscript()
                      if ( ! did_action( 'wp_enqueue_media' ) )
                      wp_enqueue_media();



                      add_action('quick_edit_custom_box', 'misha_add_featured_image_quick_edit', 10, 2);
                      function misha_add_featured_image_quick_edit( $column_name, $post_type )

                      // add it only if we have featured image column
                      if ($column_name != 'featured_image') return;

                      // we add #misha_featured_image to use it in JavaScript in CSS
                      echo '<fieldset id="misha_featured_image" class="inline-edit-col-left">
                      <div class="inline-edit-col">
                      <span class="title">Featured Image</span>
                      <div>
                      <a href="#" class="misha_upload_featured_image">Set featured image</a>
                      <input type="hidden" name="_thumbnail_id" value="" />
                      <a href="#" class="misha_remove_featured_image">Remove Featured Image</a>
                      </div>
                      </div></fieldset>';

                      // please look at _thumbnail_id as a name attribute - I use it to skip save_post action



                      add_action('admin_footer', 'misha_quick_edit_js_update');
                      function misha_quick_edit_js_update()


                      If you want more details on how this works and what each part of code does, refer to the tutorial by Misha Rudrastyh.






                      share|improve this answer



























                        1














                        Yes, it can be done very easily. There is a great tutorial by Misha Rudrastyh on how to add Featured Images to Quick Edit. I recently applied it and can confirm that it works. You will be able to see the featured images in the admin area post lists and easily change them using Quick Edit. It is a very good alternative to using a plugin.



                        Copy and paste the following to your functions.php file:



                        /*
                        *
                        * Add Featured Image Column to Admin Area and Quick Edit menu
                        * Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html
                        *
                        */

                        /*
                        * This action hook allows to add a new empty column
                        */
                        add_filter('manage_post_posts_columns', 'misha_featured_image_column');
                        function misha_featured_image_column( $column_array )

                        // I want to add my column at the beginning, so I use array_slice()
                        // in other cases $column_array['featured_image'] = 'Featured Image' will be enough
                        $column_array = array_slice( $column_array, 0, 1, true )
                        + array('featured_image' => 'Featured Image') // our new column for featured images
                        + array_slice( $column_array, 1, NULL, true );

                        return $column_array;


                        /*
                        * This hook will fill our column with data
                        */
                        add_action('manage_posts_custom_column', 'misha_render_the_column', 10, 2);
                        function misha_render_the_column( $column_name, $post_id )

                        if( $column_name == 'featured_image' )

                        // if there is no featured image for this post, print the placeholder
                        if( has_post_thumbnail( $post_id ) )

                        // I know about get_the_post_thumbnail() function but we need data-id attribute here
                        $thumb_id = get_post_thumbnail_id( $post_id );
                        echo '<img data-id="' . $thumb_id . '" src="' . wp_get_attachment_url( $thumb_id ) . '" />';

                        else

                        // data-id should be "-1" I will explain below
                        echo '<img data-id="-1" src="' . get_stylesheet_directory_uri() . '/placeholder.png" />';







                        add_action( 'admin_head', 'misha_custom_css' );
                        function misha_custom_css()

                        echo '<style>
                        #featured_image
                        width:120px;

                        td.featured_image.column-featured_image img
                        max-width: 100%;
                        height: auto;


                        /* some styles to make Quick Edit meny beautiful */
                        #misha_featured_image .titlemargin-top:10px;display:block;
                        #misha_featured_image a.misha_upload_featured_image
                        display:inline-block;
                        margin:10px 0 0;

                        #misha_featured_image img
                        display:block;
                        max-width:200px !important;
                        height:auto;

                        #misha_featured_image .misha_remove_featured_image
                        display:none;

                        </style>';



                        add_action( 'admin_enqueue_scripts', 'misha_include_myuploadscript' );
                        function misha_include_myuploadscript()
                        if ( ! did_action( 'wp_enqueue_media' ) )
                        wp_enqueue_media();



                        add_action('quick_edit_custom_box', 'misha_add_featured_image_quick_edit', 10, 2);
                        function misha_add_featured_image_quick_edit( $column_name, $post_type )

                        // add it only if we have featured image column
                        if ($column_name != 'featured_image') return;

                        // we add #misha_featured_image to use it in JavaScript in CSS
                        echo '<fieldset id="misha_featured_image" class="inline-edit-col-left">
                        <div class="inline-edit-col">
                        <span class="title">Featured Image</span>
                        <div>
                        <a href="#" class="misha_upload_featured_image">Set featured image</a>
                        <input type="hidden" name="_thumbnail_id" value="" />
                        <a href="#" class="misha_remove_featured_image">Remove Featured Image</a>
                        </div>
                        </div></fieldset>';

                        // please look at _thumbnail_id as a name attribute - I use it to skip save_post action



                        add_action('admin_footer', 'misha_quick_edit_js_update');
                        function misha_quick_edit_js_update()


                        If you want more details on how this works and what each part of code does, refer to the tutorial by Misha Rudrastyh.






                        share|improve this answer

























                          1












                          1








                          1







                          Yes, it can be done very easily. There is a great tutorial by Misha Rudrastyh on how to add Featured Images to Quick Edit. I recently applied it and can confirm that it works. You will be able to see the featured images in the admin area post lists and easily change them using Quick Edit. It is a very good alternative to using a plugin.



                          Copy and paste the following to your functions.php file:



                          /*
                          *
                          * Add Featured Image Column to Admin Area and Quick Edit menu
                          * Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html
                          *
                          */

                          /*
                          * This action hook allows to add a new empty column
                          */
                          add_filter('manage_post_posts_columns', 'misha_featured_image_column');
                          function misha_featured_image_column( $column_array )

                          // I want to add my column at the beginning, so I use array_slice()
                          // in other cases $column_array['featured_image'] = 'Featured Image' will be enough
                          $column_array = array_slice( $column_array, 0, 1, true )
                          + array('featured_image' => 'Featured Image') // our new column for featured images
                          + array_slice( $column_array, 1, NULL, true );

                          return $column_array;


                          /*
                          * This hook will fill our column with data
                          */
                          add_action('manage_posts_custom_column', 'misha_render_the_column', 10, 2);
                          function misha_render_the_column( $column_name, $post_id )

                          if( $column_name == 'featured_image' )

                          // if there is no featured image for this post, print the placeholder
                          if( has_post_thumbnail( $post_id ) )

                          // I know about get_the_post_thumbnail() function but we need data-id attribute here
                          $thumb_id = get_post_thumbnail_id( $post_id );
                          echo '<img data-id="' . $thumb_id . '" src="' . wp_get_attachment_url( $thumb_id ) . '" />';

                          else

                          // data-id should be "-1" I will explain below
                          echo '<img data-id="-1" src="' . get_stylesheet_directory_uri() . '/placeholder.png" />';







                          add_action( 'admin_head', 'misha_custom_css' );
                          function misha_custom_css()

                          echo '<style>
                          #featured_image
                          width:120px;

                          td.featured_image.column-featured_image img
                          max-width: 100%;
                          height: auto;


                          /* some styles to make Quick Edit meny beautiful */
                          #misha_featured_image .titlemargin-top:10px;display:block;
                          #misha_featured_image a.misha_upload_featured_image
                          display:inline-block;
                          margin:10px 0 0;

                          #misha_featured_image img
                          display:block;
                          max-width:200px !important;
                          height:auto;

                          #misha_featured_image .misha_remove_featured_image
                          display:none;

                          </style>';



                          add_action( 'admin_enqueue_scripts', 'misha_include_myuploadscript' );
                          function misha_include_myuploadscript()
                          if ( ! did_action( 'wp_enqueue_media' ) )
                          wp_enqueue_media();



                          add_action('quick_edit_custom_box', 'misha_add_featured_image_quick_edit', 10, 2);
                          function misha_add_featured_image_quick_edit( $column_name, $post_type )

                          // add it only if we have featured image column
                          if ($column_name != 'featured_image') return;

                          // we add #misha_featured_image to use it in JavaScript in CSS
                          echo '<fieldset id="misha_featured_image" class="inline-edit-col-left">
                          <div class="inline-edit-col">
                          <span class="title">Featured Image</span>
                          <div>
                          <a href="#" class="misha_upload_featured_image">Set featured image</a>
                          <input type="hidden" name="_thumbnail_id" value="" />
                          <a href="#" class="misha_remove_featured_image">Remove Featured Image</a>
                          </div>
                          </div></fieldset>';

                          // please look at _thumbnail_id as a name attribute - I use it to skip save_post action



                          add_action('admin_footer', 'misha_quick_edit_js_update');
                          function misha_quick_edit_js_update()


                          If you want more details on how this works and what each part of code does, refer to the tutorial by Misha Rudrastyh.






                          share|improve this answer













                          Yes, it can be done very easily. There is a great tutorial by Misha Rudrastyh on how to add Featured Images to Quick Edit. I recently applied it and can confirm that it works. You will be able to see the featured images in the admin area post lists and easily change them using Quick Edit. It is a very good alternative to using a plugin.



                          Copy and paste the following to your functions.php file:



                          /*
                          *
                          * Add Featured Image Column to Admin Area and Quick Edit menu
                          * Source: https://rudrastyh.com/wordpress/quick-edit-featured-image.html
                          *
                          */

                          /*
                          * This action hook allows to add a new empty column
                          */
                          add_filter('manage_post_posts_columns', 'misha_featured_image_column');
                          function misha_featured_image_column( $column_array )

                          // I want to add my column at the beginning, so I use array_slice()
                          // in other cases $column_array['featured_image'] = 'Featured Image' will be enough
                          $column_array = array_slice( $column_array, 0, 1, true )
                          + array('featured_image' => 'Featured Image') // our new column for featured images
                          + array_slice( $column_array, 1, NULL, true );

                          return $column_array;


                          /*
                          * This hook will fill our column with data
                          */
                          add_action('manage_posts_custom_column', 'misha_render_the_column', 10, 2);
                          function misha_render_the_column( $column_name, $post_id )

                          if( $column_name == 'featured_image' )

                          // if there is no featured image for this post, print the placeholder
                          if( has_post_thumbnail( $post_id ) )

                          // I know about get_the_post_thumbnail() function but we need data-id attribute here
                          $thumb_id = get_post_thumbnail_id( $post_id );
                          echo '<img data-id="' . $thumb_id . '" src="' . wp_get_attachment_url( $thumb_id ) . '" />';

                          else

                          // data-id should be "-1" I will explain below
                          echo '<img data-id="-1" src="' . get_stylesheet_directory_uri() . '/placeholder.png" />';







                          add_action( 'admin_head', 'misha_custom_css' );
                          function misha_custom_css()

                          echo '<style>
                          #featured_image
                          width:120px;

                          td.featured_image.column-featured_image img
                          max-width: 100%;
                          height: auto;


                          /* some styles to make Quick Edit meny beautiful */
                          #misha_featured_image .titlemargin-top:10px;display:block;
                          #misha_featured_image a.misha_upload_featured_image
                          display:inline-block;
                          margin:10px 0 0;

                          #misha_featured_image img
                          display:block;
                          max-width:200px !important;
                          height:auto;

                          #misha_featured_image .misha_remove_featured_image
                          display:none;

                          </style>';



                          add_action( 'admin_enqueue_scripts', 'misha_include_myuploadscript' );
                          function misha_include_myuploadscript()
                          if ( ! did_action( 'wp_enqueue_media' ) )
                          wp_enqueue_media();



                          add_action('quick_edit_custom_box', 'misha_add_featured_image_quick_edit', 10, 2);
                          function misha_add_featured_image_quick_edit( $column_name, $post_type )

                          // add it only if we have featured image column
                          if ($column_name != 'featured_image') return;

                          // we add #misha_featured_image to use it in JavaScript in CSS
                          echo '<fieldset id="misha_featured_image" class="inline-edit-col-left">
                          <div class="inline-edit-col">
                          <span class="title">Featured Image</span>
                          <div>
                          <a href="#" class="misha_upload_featured_image">Set featured image</a>
                          <input type="hidden" name="_thumbnail_id" value="" />
                          <a href="#" class="misha_remove_featured_image">Remove Featured Image</a>
                          </div>
                          </div></fieldset>';

                          // please look at _thumbnail_id as a name attribute - I use it to skip save_post action



                          add_action('admin_footer', 'misha_quick_edit_js_update');
                          function misha_quick_edit_js_update()


                          If you want more details on how this works and what each part of code does, refer to the tutorial by Misha Rudrastyh.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 12 hours ago









                          jsmodjsmod

                          1269




                          1269



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to WordPress Development Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f331865%2fadding-featured-image-in-post-list%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Францішак Багушэвіч Змест Сям'я | Біяграфія | Творчасць | Мова Багушэвіча | Ацэнкі дзейнасці | Цікавыя факты | Спадчына | Выбраная бібліяграфія | Ушанаванне памяці | У філатэліі | Зноскі | Літаратура | Спасылкі | НавігацыяЛяхоўскі У. Рупіўся дзеля Бога і людзей: Жыццёвы шлях Лявона Вітан-Дубейкаўскага // Вольскі і Памідораў з песняй пра немца Адвакат, паэт, народны заступнік Ашмянскі веснікВ Минске появится площадь Богушевича и улица Сырокомли, Белорусская деловая газета, 19 июля 2001 г.Айцец беларускай нацыянальнай ідэі паўстаў у бронзе Сяргей Аляксандравіч Адашкевіч (1918, Мінск). 80-я гады. Бюст «Францішак Багушэвіч».Яўген Мікалаевіч Ціхановіч. «Партрэт Францішка Багушэвіча»Мікола Мікалаевіч Купава. «Партрэт зачынальніка новай беларускай літаратуры Францішка Багушэвіча»Уладзімір Іванавіч Мелехаў. На помніку «Змагарам за родную мову» Барэльеф «Францішак Багушэвіч»Памяць пра Багушэвіча на Віленшчыне Страчаная сталіца. Беларускія шыльды на вуліцах Вільні«Krynica». Ideologia i przywódcy białoruskiego katolicyzmuФранцішак БагушэвічТворы на knihi.comТворы Францішка Багушэвіча на bellib.byСодаль Уладзімір. Францішак Багушэвіч на Лідчыне;Луцкевіч Антон. Жыцьцё і творчасьць Фр. Багушэвіча ў успамінах ягоных сучасьнікаў // Запісы Беларускага Навуковага таварыства. Вільня, 1938. Сшытак 1. С. 16-34.Большая российская1188761710000 0000 5537 633Xn9209310021619551927869394п

                              Беларусь Змест Назва Гісторыя Геаграфія Сімволіка Дзяржаўны лад Палітычныя партыі Міжнароднае становішча і знешняя палітыка Адміністрацыйны падзел Насельніцтва Эканоміка Культура і грамадства Сацыяльная сфера Узброеныя сілы Заўвагі Літаратура Спасылкі НавігацыяHGЯOiТоп-2011 г. (па версіі ej.by)Топ-2013 г. (па версіі ej.by)Топ-2016 г. (па версіі ej.by)Топ-2017 г. (па версіі ej.by)Нацыянальны статыстычны камітэт Рэспублікі БеларусьШчыльнасць насельніцтва па краінахhttp://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/А. Калечыц, У. Ксяндзоў. Спробы засялення краю неандэртальскім чалавекам.І ў Менску былі мамантыА. Калечыц, У. Ксяндзоў. Старажытны каменны век (палеаліт). Першапачатковае засяленне тэрыторыіГ. Штыхаў. Балты і славяне ў VI—VIII стст.М. Клімаў. Полацкае княства ў IX—XI стст.Г. Штыхаў, В. Ляўко. Палітычная гісторыя Полацкай зямліГ. Штыхаў. Дзяржаўны лад у землях-княствахГ. Штыхаў. Дзяржаўны лад у землях-княствахБеларускія землі ў складзе Вялікага Княства ЛітоўскагаЛюблінская унія 1569 г."The Early Stages of Independence"Zapomniane prawdy25 гадоў таму было аб'яўлена, што Язэп Пілсудскі — беларус (фота)Наша вадаДакументы ЧАЭС: Забруджванне тэрыторыі Беларусі « ЧАЭС Зона адчужэнняСведения о политических партиях, зарегистрированных в Республике Беларусь // Министерство юстиции Республики БеларусьСтатыстычны бюлетэнь „Полаўзроставая структура насельніцтва Рэспублікі Беларусь на 1 студзеня 2012 года і сярэднегадовая колькасць насельніцтва за 2011 год“Индекс человеческого развития Беларуси — не было бы нижеБеларусь занимает первое место в СНГ по индексу развития с учетом гендерного факцёраНацыянальны статыстычны камітэт Рэспублікі БеларусьКанстытуцыя РБ. Артыкул 17Трансфармацыйныя задачы БеларусіВыйсце з крызісу — далейшае рэфармаванне Беларускі рубель — сусветны лідар па дэвальвацыяхПра змену коштаў у кастрычніку 2011 г.Бядней за беларусаў у СНД толькі таджыкіСярэдні заробак у верасні дасягнуў 2,26 мільёна рублёўЭканомікаГаласуем за ТОП-100 беларускай прозыСучасныя беларускія мастакіАрхитектура Беларуси BELARUS.BYА. Каханоўскі. Культура Беларусі ўсярэдзіне XVII—XVIII ст.Анталогія беларускай народнай песні, гуказапісы спеваўБеларускія Музычныя IнструментыБеларускі рок, які мы страцілі. Топ-10 гуртоў«Мясцовы час» — нязгаслая легенда беларускай рок-музыкіСЯРГЕЙ БУДКІН. МЫ НЯ ЗНАЕМ СВАЁЙ МУЗЫКІМ. А. Каладзінскі. НАРОДНЫ ТЭАТРМагнацкія культурныя цэнтрыПублічная дыскусія «Беларуская новая пьеса: без беларускай мовы ці беларуская?»Беларускія драматургі па-ранейшаму лепш ставяцца за мяжой, чым на радзіме«Працэс незалежнага кіно пайшоў, і дзяржаву турбуе яго непадкантрольнасць»Беларускія філосафы ў пошуках прасторыВсе идём в библиотекуАрхіваванаАб Нацыянальнай праграме даследавання і выкарыстання касмічнай прасторы ў мірных мэтах на 2008—2012 гадыУ космас — разам.У суседнім з Барысаўскім раёне пабудуюць Камандна-вымяральны пунктСвяты і абрады беларусаў«Мірныя бульбашы з малой краіны» — 5 непраўдзівых стэрэатыпаў пра БеларусьМ. Раманюк. Беларускае народнае адзеннеУ Беларусі скарачаецца колькасць злачынстваўЛукашэнка незадаволены мінскімі ўладамі Крадзяжы складаюць у Мінску каля 70% злачынстваў Узровень злачыннасці ў Мінскай вобласці — адзін з самых высокіх у краіне Генпракуратура аналізуе стан са злачыннасцю ў Беларусі па каэфіцыенце злачыннасці У Беларусі стабілізавалася крымінагеннае становішча, лічыць генпракурорЗамежнікі сталі здзяйсняць у Беларусі больш злачынстваўМУС Беларусі турбуе рост рэцыдыўнай злачыннасціЯ з ЖЭСа. Дазволіце вас абкрасці! Рэйтынг усіх службаў і падраздзяленняў ГУУС Мінгарвыканкама вырасАб КДБ РБГісторыя Аператыўна-аналітычнага цэнтра РБГісторыя ДКФРТаможняagentura.ruБеларусьBelarus.by — Афіцыйны сайт Рэспублікі БеларусьСайт урада БеларусіRadzima.org — Збор архітэктурных помнікаў, гісторыя Беларусі«Глобус Беларуси»Гербы и флаги БеларусиАсаблівасці каменнага веку на БеларусіА. Калечыц, У. Ксяндзоў. Старажытны каменны век (палеаліт). Першапачатковае засяленне тэрыторыіУ. Ксяндзоў. Сярэдні каменны век (мезаліт). Засяленне краю плямёнамі паляўнічых, рыбакоў і збіральнікаўА. Калечыц, М. Чарняўскі. Плямёны на тэрыторыі Беларусі ў новым каменным веку (неаліце)А. Калечыц, У. Ксяндзоў, М. Чарняўскі. Гаспадарчыя заняткі ў каменным векуЭ. Зайкоўскі. Духоўная культура ў каменным векуАсаблівасці бронзавага веку на БеларусіФарміраванне супольнасцей ранняга перыяду бронзавага векуФотографии БеларусиРоля беларускіх зямель ва ўтварэнні і ўмацаванні ВКЛВ. Фадзеева. З гісторыі развіцця беларускай народнай вышыўкіDMOZGran catalanaБольшая российскаяBritannica (анлайн)Швейцарскі гістарычны15325917611952699xDA123282154079143-90000 0001 2171 2080n9112870100577502ge128882171858027501086026362074122714179пппппп

                              ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 6 (SMOTE) The 2019 Stack Overflow Developer Survey Results Are InCan SMOTE be applied over sequence of words (sentences)?ValueError when doing validation with random forestsSMOTE and multi class oversamplingLogic behind SMOTE-NC?ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)SmoteBoost: Should SMOTE be ran individually for each iteration/tree in the boosting?solving multi-class imbalance classification using smote and OSSUsing SMOTE for Synthetic Data generation to improve performance on unbalanced dataproblem of entry format for a simple model in KerasSVM SMOTE fit_resample() function runs forever with no result