WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Featured Image
[resolved] Installed into 3.8 and theme 2014 - not working (13 posts)

  1. metame
    Member
    Posted 5 months ago #

    Hi, I am new to using WP, and installed v 2.0.1 into 2014 theme and wp 3.8.1 as there was no indication that this would not work. I have the second theme box - go to add image, when I select "add to post" the box goes blank, and nothing happens. Is there something else I have to do to make it work?

    https://wordpress.org/plugins/dynamic-featured-image/

  2. Ankit Pokhrel
    Member
    Plugin Author

    Posted 5 months ago #

    Hello metame,

    I checked the plugin (v2.0.1) in a fresh WordPress(v3.8.1) installation and it is working as it should. Please visit these posts. Hopefully it will help you to solve the issue.

    1. https://github.com/ankitpokhrel/Dynamic-Featured-Image/issues/9

    2. http://ankitpokhrel.com.np/blog/the-media-uploader-screen-freezes-and-stays-blank-after-clicking-insert-into-post/

    Thanks,
    Ankit

  3. metame
    Member
    Posted 5 months ago #

    Hi Ankit, I looked at what you advised, and saw I had to click the URL, and that at least inserted image into second featured image in the page set up. I updated, but still not seeing a second featured image... what I am I doing wrong?

  4. sixtyseven
    Member
    Posted 5 months ago #

    I have similar problems:

    TypeError: imgUrl is undefined

    What a pitty, it seems that this could be exactly what I need.

  5. Ankit Pokhrel
    Member
    Plugin Author

    Posted 5 months ago #

    Hello Sixtyseven,

    Sorry to know that it didn't work for you. I just tried it in fresh installation (WP 3.8.1 and Plugin ver. 2.0.2 ) and it is working as it should.

    Would you like to try ver. 3.0.0? It is still under development but you can use it for normal use. You can download it from here (master branch). Sadly i am still not able to write the documentation for this version.

    Thank you!

  6. Ankit Pokhrel
    Member
    Plugin Author

    Posted 5 months ago #

    Hello Sixtyseven,

    Sorry to know that it didn't work for you. I just tried it in fresh installation (WP 3.8.1 and Plugin ver. 2.0.2 ) and it is working as it should.

    Would you like to try ver. 3.0.0? It is still under development but you can use it for normal use. You can download it from here (master branch). Sadly i am still not able to write the documentation for this version.

    Thank you!

  7. sixtyseven
    Member
    Posted 5 months ago #

    Hello Ankit,

    I'll give it a try when I am in the office on monday. You'll get a feedback a.s.a.p. Thank you for your effort and greetings from Germany!

  8. sixtyseven
    Member
    Posted 5 months ago #

    Hello Ankit,

    the new Version works like a charm ;-) Although I probably have a proposal for a little enhancement:

    In my case I need to fetch a special image size called 'blog_featured'. So I have to fetch those like this:

    if( class_exists('Dynamic_Featured_Image') ) {
    	global $dynamic_featured_image;
           $dfi_featured = $dynamic_featured_image->get_post_attachment_ids($post->ID);
           # Now, loop through the image to display
    	   foreach($dfi_featured as $image){
    		  $attachment_id = intval($image);
    		  $src = wp_get_attachment_image_src( $attachment_id, 'blog_featured');
    		  if (count($src) == 4) {
    		  	$feat_images[] = '<img width="'.$src[1].'" height="'.$src[2].'" src="'.$src[0].'" >';
    		  }
    	   }
       }

    It would be nice, if you could return all registered image sizes in the function get_featured_images(), not only 'thumb' and 'full'. Would make my life as a 'pseudo-programmer' a lot easier ;-)

  9. Ankit Pokhrel
    Member
    Plugin Author

    Posted 5 months ago #

    Hello sixtyseven,

    Glad to know that it worked :) . Thank you for the enhancement proposal along with the solution. I will add this functionality in the future version.

    A plugin review at http://wordpress.org/support/view/plugin-reviews/dynamic-featured-image would be a great help ;)

    Regards,
    Ankit

  10. sixtyseven
    Member
    Posted 5 months ago #

    Done! Your support was gladly appreciated!

  11. sixtyseven
    Member
    Posted 5 months ago #

    I probably have another little enhancement proposal. How about having a setting for the post types, in which the meta box appears? I think there is no need for a settings page, a simple hook will do:

    $filter = array( 'attachment', 'revision', 'nav_menu_item' );
    $postTypes = get_post_types();
    do_action('dfi_post_types', $postTypes);
    $postTypes = array_diff( $postTypes, $filter );

    by doing so, we could have an easy interface, like this:

    add_filter('dfi_post_types', 'my_function');
    function my_function($postTypes){
    	$posttypes_to_exclude = array('posttype1','posttype2','posttype3');
    
    	foreach ($posttypes_to_exclude as $posttype){
    		$key = array_search($posttype,$postTypes);
    		if($key!==false){
    			unset($postTypes[$key]);
    		}
    	}
    
    	return $postTypes;
    }

    But maybe incorporating a settings page would be the key for a future update ;-)

  12. sixtyseven
    Member
    Posted 5 months ago #

    Oh boy, the above code is a mess. It should be

    $postTypes = apply_filters( 'dfi_post_types', $postTypes );

    instead of the do_action hook, and the call should be

    add_filter('dfi_post_types', 'remove_post_types', 10, 1);

    I should eventually test my code before posting it ;-)

  13. Ankit Pokhrel
    Member
    Plugin Author

    Posted 5 months ago #

    Hello sixtyseven,

    Nice idea! Since you have already provided the solution, how about being the contributor of the plugin? You can fork, make changes and send the pull request. This project can be found in github: https://github.com/ankitpokhrel/Dynamic-Featured-Image

    Thanks,
    Ankit

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.