Originally Posted in the wrong place, I think this is the correct place for this.
Hello, I am very new to wordpress and webdesign in gerneral. I am VERY much in need of some help with installing this plugin. I’ve been all over google and I have read the read me but its over my head… There is alot of people on google who have the same problem, only I know what the problem is, just not how to fix it.
The problem is the plugin called “user-submitted-posts”, allows user to submit images to your blog. Well it doesnt actually post the images without using this template tag. From the read me file:
To display the images attached to user-submitted posts, use this template tag:
<?php post_attachments(); ?>
This template tag prints the URLs for all post attachments and accepts the following paramters:
<?php post_attachments($size, $beforeUrl, $afterUrl, $numberImages, $postId); ?>
$size = image size as thumbnail, medium, large or full -> default = full
$beforeUrl = text/markup displayed before the image URL -> default = <img src=”
$afterUrl = text/markup displayed after the image URL -> default = ” />
$numberImages = the number of images to display for each post -> default = false (display all)
$postId = an optional post ID to use -> default = uses global post
Additionally, the following template tag returns an array of URLs for the specified post image:
<?php get_post_images(); ?>
This tag returns a boolean value indicating whether the specified post is a public submission:
<?php is_public_submission(); ?>
Is there anyone out there that will give me help like I am slow? Telling me what line and where to paste it in? I dont see myself understanding it. My homepage is VERY simple and has almost nothing modified on it yet. And really im not even sure it goes on the homepage. The home page is where the posts are being posted with the needed image files that are not showing up.
and if it makes a difference this is from the plugins site:
Display image attachments for submitted posts
This template tag displays the images attached to user-submitted posts:
<?php post_attachments(); ?>
The post_attachments template tag prints the URLs for the specified image attachments. It accepts the following parameters:
<?php post_attachments($size, $beforeUrl, $afterUrl, $numberImages, $postId); ?> $size = image size as thumbnail, medium, large or full -> default = full $beforeUrl = text/markup displayed before the image URL -> default = <img src=" $afterUrl = text/markup displayed after the image URL -> default = " /> $numberImages = the number of images to display for each post -> default = false (display all) $postId = an optional post ID to use -> default = uses global post
I’d like to know where to insert the code to enable displaying images too. Not an expert in coding and it’s frustrating that developers of plugins write for other experts and not for beginners.
well lets keep each other updated. If you figure it out let me know and if you do post back here. 😀
I’ve tried placing it on the various loop pages inside the areas that say start loop and end loop… I managed to get the pictures to show up but when they show up they take the place of the comments or I get errors on my form….No idea what to do.
Really if I could just get confirmation on which page to place the template tag i might be able to figure it out.
so… separate page holds the upload form… then the pics should show up in the comments section on the main page. Should this template tag be placed in the index.php within the loop? Or does it need to go on one of the actual loop pages? I have tried both but if I could pin point it I might be able to get lucky and get it working.
It would be nice to get some information in uploading multiple images but I can settle with just one. Multiple seems a lot more involving with code.
I am also looking for an answer to this question and would be grateful to anyone who could clarify the process of displaying attached images. Thanks!
First you should create a child theme so your changes aren’t lost when you update your theme. Check the Codex on how to do this, it’s fairly easy.
Then you need to determine which theme templates you need to add the tag to get the result you are after. One is likely content-single.php. There may be others. Figuring out which templates your theme is using can be difficult. I like to add an html comment containing the name of the template near the top of each template. Then, when you view your page source, you can easily see which templates are being used and where.
Copy all templates you need to change to your child theme. On each template, locate where the post content is being generated. It’s usually the tag
the_content(). Place the plugin tag either before or after
the_content(), depending on where you want the images displayed. To display large size images after the post on the content-single.php template of the twentyeleven theme, the relevant section should look like this when you’re done:
<div class="entry-content"> <?php the_content(); ?> <?php post_attachments('large'); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?> </div><!-- .entry-content -->
Don’t forget to activate your new child theme before testing!
Disclaimer: I don’t use this plugin, nor have I examined it. My suggested code above is based solely on the documentation quoted by the OP. It is not tested, but it is the logical thing to try first. The documentation says this will display all images attached to the post with no additional coding needed.
- The topic ‘Help embedding a template tag from a plugin’ is closed to new replies.