Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Thread Starter pallisvans

    (@pallisvans)

    Wow, instant support ?? Thanks a million Jeff and your plugin is the best I’ve run across for this kind of thing.

    Plugin Author Jeff Starr

    (@specialk)

    Happy to help! Thanks for trying the plugin ??

    Don’t know if it’s the right thing to do but I needed only one image to be sent and displayed directly as featured image. I edited the plugin like this:

    in user-submitted-posts.php

    I changed :

    add_post_meta($newPost, $usp_post_meta_Image,wp_get_attachment_url($attachmentId));

    by:

    if ($i > 0)
      add_post_meta($newPost, $usp_post_meta_Image,wp_get_attachment_url($attachmentId));
    else
      set_post_thumbnail($newPost,$attachmentId);
    Plugin Author Jeff Starr

    (@specialk)

    Here is the recommended way of doing it:

    https://wp-mix.com/set-attachment-featured-image/

    yoyos33, I can’t find your string in user-submitted-post.php.
    I’m using 20130104 version with WP 3.5.1.

    i used code from wp-mix .. i past below in function.php but it display now only one image in the post >>

    what if i would like visitor to upload 3 images

    // featured images
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size(130, 100, true); // width, height, hard crop
    
    // @ https://wp-mix.com/set-attachment-featured-image/
    add_filter('the_content', 'set_featured_image_from_attachment');
    function set_featured_image_from_attachment($content) {
    	global $post;
    	if (has_post_thumbnail()) {
    		// display the featured image
    		$content = the_post_thumbnail() . $content;
    	} else {
    		// get & set the featured image
    		$attachments = get_children(array(
    			'post_parent' => $post->ID,
    			'post_status' => 'inherit',
    			'post_type' => 'attachment',
    			'post_mime_type' => 'image',
    			'order' => 'ASC',
    			'orderby' => 'menu_order'
    		));
    		if ($attachments) {
    			foreach ($attachments as $attachment) {
    				set_post_thumbnail($post->ID, $attachment->ID);
    				break;
    			}
    			// display the featured image
    			$content = the_post_thumbnail() . $content;
    		}
    	}
    	return $content;
    }
    Plugin Author Jeff Starr

    (@specialk)

    To display images in posts, you’ll need to use either WP’s built-in template tags or the template tags included with the plugin. Please read the readme.txt file for everything you need to display images in posts. Thank you.

    Hi Jeff,

    I followed the instruction as per link (wp-mix). but then the image showed at not only as features image also at content of post. mean it double images(same image).

    How can I set only at features image without added it at post?
    hope you understand my poor english.

    Thanks

    Plugin Author Jeff Starr

    (@specialk)

    Hi adammuaz,

    It sounds like your theme may be including the featured image, so adding the code would cause a second featured image to be displayed.. (but it’s just a guess). To determine if that’s the case, try using the code with the default WP theme (currently Twenty Twelve).

    Hi Jeff,

    Thanks for reply. I did use the default theme.but it same.
    check at my test site. https://nelaye.com/blog/

    My target is to display only feature image without display image at the post. hope you can help me. thanks alot!

    function autoset_featured() {
              global $post;
              $already_has_thumb = has_post_thumbnail($post->ID);
                  if (!$already_has_thumb)  {
                  $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
                              if ($attached_image) {
                                    foreach ($attached_image as $attachment_id => $attachment) {
                                    set_post_thumbnail($post->ID, $attachment_id);
                                    }
                               }
                            }
          }
    add_action('the_post', 'autoset_featured');
    add_action('save_post', 'autoset_featured');
    add_action('draft_to_publish', 'autoset_featured');
    add_action('new_to_publish', 'autoset_featured');
    add_action('pending_to_publish', 'autoset_featured');
    add_action('future_to_publish', 'autoset_featured');

    Hello Jeff,
    I have been working on getting your plugin to display images for the last 3 days w/o success. The closest I have got is getting the image to display in the user submitted post but all other post types display a duplicate of the featured image for that post.

    I realize you have supplied template tags but not sure which files they belong nor where in the php they should be placed, for I am not a php developer. I am trying to implement the example provided on WP-Mix for displaying attached images.

    My single.php file looks as so:

    [Moderator note – too much code to post here please see:
    https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]

    the first bold section seems to display the first image, the next bold php (inserted from wp-mix) is inserting the 2nd image within the post. I have tried numerous things.
    Any help is apreciated.
    Thanks

    @aprilbrady – please start a new thread per https://codex.www.ads-software.com/Forum_Welcome#Where_To_Post – this one is marked resolved – you can do so here:

    https://www.ads-software.com/support/plugin/user-submitted-posts#postform

    Also, please do not post large amounts of code on the forums – use a pastebin – see:
    https://codex.www.ads-software.com/Forum_Welcome#Posting_Code

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Images posted as Featured images?’ is closed to new replies.