Support » Fixing WordPress » Help embedding a template tag from a plugin

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    ke86

    (@ke86)

    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!

    Moderator bcworkz

    (@bcworkz)

    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.

    Happy hacking!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help embedding a template tag from a plugin’ is closed to new replies.