User Submitted Posts
[resolved] Images Don't Display After Uploading (34 posts)

  1. Black Hati
    Posted 3 years ago #

    That images is upload on post but not "Insert to post" automaticly.

    In this case im set upload only 1 image can upload by them (user submit post).

    Then to show image automaticly im using this php code to call automatickly on they post.

    <a href="<?php the_permalink() ?>"><img src="<?php
        global $post;
        $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_mime_type' => 'image', 'post_status' => null, 'post_parent' => $post->ID );
        $attachments = get_posts($args);
        if ($attachments) {
                foreach ( $attachments as $attachment ) {
                        // Method #1: Allows you to define the image size
                        $src = wp_get_attachment_image_src( $attachment->ID, "attached-image");
                        if ($src) {echo $src[-1];}
                        // Method #2: Would always return the "attached-image" size
                        echo $attachment->guid;
    ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>"></img></a>

    P.S : insert in your current themes single.php
    OPTIONAL: more easy insert this php code after install plugin add injection and php code widget, after activated ad injection and php code widget, put this code USING AD INJECTION

  2. Jeff Starr
    Plugin Author

    Posted 3 years ago #

    That may work fine, Black Hati, but it would be better to modify theme files (if/when possible) rather than execute any PHP from posts and pages. Either way, glad to see you figured it out.

  3. Black Hati
    Posted 3 years ago #

    Jeff, please parse here your code suggestion to modify themes file. Im hard to call back image url after upload to embed this :(

  4. tokara
    Posted 3 years ago #

    Hello Jeff
    Thanks for the plugin.
    As far the this thread, attached image goes into the libragy and has to me manually inserted into the post.
    However, I have a different concern, I set max 3 files to attach, but in fact it does not work. Once I select the first tile and click ADD ANOTHER IMAGE, and select the second file, the fist one get replaced and I cann't upload more than one file.
    Would appreciate your suggestions

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • User Submitted Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.