Image behaviour in ImagePress – single page or media view

There are two ways of displaying a gallery image: single view or media view. The ImagePress image behaviour dictates what to open when clicking on an image (single image or custom post template).

ImagePress Image Behaviour

If you pick media view, all gallery images will open in a full tab, or, if you have a lightbox plugin installed and active, in a lightbox/modal window.

The media view requires no custom coding on your part.

The single view, on the other hand, requires setting up a new single template. The most basic example requires you to duplicate your single.php or singular.php template (or, in some cases, even page.php) and replace the_content() with if (function_exists('ip_main')) { ip_main(get_the_ID()); }. See a brief example below:

<?php get_header(); ?>

<section id="content" role="main">
    <?php if (have_posts()) : while(have_posts()) : the_post(); ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            /* BEGIN IMAGEPRESS CODE */
            if (function_exists('ip_main')) {
            /* END IMAGEPRESS CODE */

        <?php comments_template('', true); ?>
    <?php endwhile; endif; ?>

<?php get_footer();

Your theme may have a different structure or use a loop template to display posts and pages. Contact me for any request or further explanations.


Contribute to this article by sharing your opinion on Twitter:

Unlimited Automated Page Speed Monitoring & Tracking.
Use SpeedFactor to track your website. It’s simple and reliable.
See how real people experience the speed of your website. Then find (and fix) your web performance problems.
Get Started
Privacy Policy