WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several images of UI forms and tasks, that are quite large. I would like to display a smaller, 'thumbnail' image snf give the user an option to 'Click to Enlarge', and then display the fill size image in either a pop-up or separate window or tab. I pop-ups are frowned upon, but this is a decision I must still make.

How would I go about this? Where would I place the JavaScript that loads the full size image and opens a new window?

share|improve this question
    
What have you researched/found/tried? Sounds to me like you're looking for thickbox/lightbox. WordPress has Thickbox built in, a simple google should produce the information you need. – t31os May 14 '13 at 9:44

You should use a lightbox for this. Try this one. It works well

http://lokeshdhakar.com/projects/lightbox2/

There are instructions on how to use it and documentation on how to get it working. The download will also contain samples and you can just copy and paste the code.

share|improve this answer
<?php get_header(); ?>
<?php get_sidebar();?>
    <div id="content">
        <?php if ( have_posts() ) : ?>
            <?php while ( have_posts() ) : the_post(); ?>
                <article id="post-<?php the_ID(); ?>" <?php post_class($class); ?>>
                    <header class="entry-header">
                        <?php if(has_post_thumbnail()):?>
                            <?php the_post_thumbnail(); ?>
                        <?php endif; ?>
                        <h1 class="entry-title">
                            <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'ifoti' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
                        </h1>
                        <?php if ( 'post' == get_post_type() ) : ?>
                        <div class="entry-meta">
                            <?php ifoti_posted_on(); ?>
                        </div><!-- .entry-meta -->
                        <?php endif; ?>
                    </header><!-- .entry-header -->

                    <?php if ( is_search() ) : // Only display Excerpts for Search ?>
                    <div class="entry-summary">
                        <?php the_excerpt(); ?>
                    </div><!-- .entry-summary -->
                    <?php else : ?>
                    <div class="entry-content">
                        <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'ifoti' ) ); ?>
                        <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'ifoti' ) . '</span>', 'after' => '</div>' ) ); ?>
                    </div><!-- .entry-content -->
                    <?php endif; ?>

                    <footer class="entry-meta">
                        <?php $show_sep = false; ?>
                        <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
                        <?php
                            $categories_list = get_the_category_list( __( ', ', 'ifoti' ) );
                            if ( $categories_list ):
                        ?>
                        <span class="cat-links">
                            <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'ifoti' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
                            $show_sep = true; ?>
                        </span>
                        <?php endif; // End if categories ?>
                        <?php
                            $tags_list = get_the_tag_list( '', __( ', ', 'ifoti' ) );
                            if ( $tags_list ):
                            if ( $show_sep ) : ?>
                        <span class="sep"> | </span>
                            <?php endif; // End if $show_sep ?>
                        <span class="tag-links">
                            <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'ifoti' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
                            $show_sep = true; ?>
                        </span>
                        <?php endif; // End if $tags_list ?>
                        <?php endif; // End if 'post' == get_post_type() ?>

                        <?php if ( comments_open() ) : ?>
                        <?php if ( $show_sep ) : ?>
                        <span class="sep"> | </span>
                        <?php endif; // End if $show_sep ?>
                        <span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'ifoti' ) . '</span>', __( '<b>1</b> Reply', 'ifoti' ), __( '<b>%</b> Replies', 'ifoti' ) ); ?></span>
                        <?php endif; // End if comments_open() ?>
                        <span class="sep"> | </span>
                        <?php edit_post_link( __( 'Edit', 'ifoti' ), '<span class="edit-link">', '</span>' ); ?>
                    </footer><!-- #entry-meta -->
                    <div class="socialbtn">
                        <!-- AddThis Button BEGIN -->
                        <div class="addthis_toolbox addthis_default_style"addthis:url="<?php the_permalink() ?>">
                            <a class="addthis_button_email">Email</a>
                            <a class="addthis_button_print">Print</a>
                            <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
                            <a class="addthis_button_tweet"></a>
                            <a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
                        </div>
                        <script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
                        <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f97067f47ad8fdb"></script>
                        <!-- AddThis Button END -->
                    </div>

                    <div>
                        <?php comments_template();?>
                    </div>
                </article><!-- #post-<?php the_ID(); ?> -->
            <?php endwhile; ?>
        <?php else : ?>
            No Result;
        <?php endif; ?>
    </div>
<?php get_footer(); ?>

List item

share|improve this answer
1  
Answers should be more than a code snippet. Please file an edit and explain why this would work. – Gabriel Dec 4 '15 at 21:31
1  
I cannot see how this remotely answers the question – Pieter Goosen Dec 5 '15 at 6:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.