Why the output of an image gallery plugin is not displayed into a page of my WordPress custom theme?

I am pretty new as WordPress developer and I am working on a theme developed by myself starting from scratch.

So, at this link you can download the entire theme so you can see in the details the entire code: http://www.asper-eritrea.com/AsperThemeV2.zip

Read More

On this website I have tried to install an image gallery plugin named GMedia Gallery (I have tried also with other plugin and I have similar problem), this one: https://it.wordpress.org/plugins/grand-media/

With this plugin I create a gallery and then going into the:

Appearance –> Menu –> GMedia Gallery —> My Gallery I add the created gallery as a page into my main menu.

And here I have a big problem because, using my custom theme, clicking on the related link into the main menu, the gallery is not shown and the page appear empty, as you can see here:

http://www.asper-eritrea.com/gmedia-gallery/eventi-e-manifestazioni/

I am pretty sure that this is an issue related to my theme because switching to any of the default WordPress theme (for example Twenty Twelve) the gallery is perfectly shown into the page, here a screenshot that proves this assertion:

enter image description here

So the problem have to be related to my custom theme because using another theme it works fine.

I have no idea about the reason of this problem. I think that maybe it could depend by the fact that I have customized the content-page.php file or that it could be related by some jQuery issue.

In the specific case, as you can see opening the theme project, I have added JQuery into the /assets/js/ directory and then I have add the JQuery support to the theme into the function.php file, in this way:

/* Function automatically executed by the hook 'load_java_scripts':
 * 1) Load all my JavaScripts
 */
function load_java_scripts() {

    // Load jQuery:
    wp_enqueue_script('jquery');
    // Load FlexSlider JavaScript
    wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array('jquery'), 'v2.1', true);
    // Load bootstrap.min.js:
    wp_enqueue_script('bootstrap.min-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array('jquery'), 'v3.0.3', true);

    // Load FancyBox:
    wp_enqueue_script('fancy-js', get_template_directory_uri() . '/assets/plugins/fancybox/jquery.fancybox.pack.js', array('jquery'), 'v2.1.5', true);
    // Load scripts.js:
    wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), '1.0', true);
    // Load Modernizer:
    wp_enqueue_script('myodernizer-js', get_template_directory_uri() . '/assets/js/modernizr.custom.js', array('jquery'), '2.6.2', true);

}

add_action('wp_enqueue_scripts', 'load_java_scripts');

But I am not so sure that it is correct because when I do:

// Load JQuery:
wp_enqueue_script('jquery');

I am not specifying the path of the jquery.js file, so what is exactly doing? (I have do it many times ago).

So what could be the problem? How can I try to fix it?

Edit 1

As suggested I am going to analyze the content of the content-page.php file that should represent the template used into the page.php that represent a generic page into the CMS (that I think that probably is where the conted of the gallery plugin is put):

<?php
/**
 * The default template for displaying content
 *
 * Used for both single and index/archive/search.
 *
 * @package WordPress
 * @subpackage AsperTheme
 * @since AsperTheme 1.0
 */
?>


<!-- Create a div with a unique ID thanks to the_ID() and semantic classes with post_class() 
     the_ID(): Print the numeric ID of the current post 
     post_class(): Print out and add various post-related classes to the div tag
-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                              

    <header>
        <h3 class="entry-title">
                <a href="<?php the_permalink(); ?>" 
                   title="<?php printf(__('Permalink to %s', 'your-theme'), the_title_attribute('echo=0')); ?>"
                   rel="bookmark"><?php the_title(); ?>
                </a>
                
        </h3>
        
        <div class="entry-meta-page">
            <span class="meta-prep meta-prep-author"><?php _e('By ', 'your-theme'); ?></span>
            <span class="author vcard">
                <a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>" 
                                    title="<?php printf(__('View all posts by %s', 'your-theme'), $authordata -> display_name); ?>"><?php the_author(); ?>
                </a>
            </span>
            <span class="meta-sep"> | </span>
            <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
            <span class="entry-date">
                <abbr class="published" title="<?php the_time('Y-m-dTH:i:sO') ?>"><?php the_time(get_option('date_format')); ?></abbr>
            </span>
            <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class="meta-sep">|</span>ntttttt<span class="edit-link">", "</span>nttttt" ) ?>
         </div>     <!-- .entry-meta -->
           
    </header>
    
    <div class="entry-content">    
        <?php the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>
        <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
    </div>      <!-- .entry-content -->
    
    <!--
    <div class="entry-utility">
        
        <span class="cat-links">
            <span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e('Posted in ', 'your-theme'); ?></span>
            <?php echo get_the_category_list(', '); ?>
        </span>
       
        <span class="meta-sep"> | </span>
        
        <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>ntttttt<span class="meta-sep">|</span>n" ) ?>
            <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
            <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class="meta-sep">|</span>ntttttt<span class="edit-link">", "</span>ntttttn" ) ?>
    </div>      <!-- #entry-utility 
    -->
                                        
</article>  <!-- #post-<?php the_ID(); ?> -->

So it seems that here there is not reference to the_content() function. But why have I to use the_content() function to display my gallery? Here on the official documentation say that it is used to display the post content, what it does that have to do with the plugin output?

Related posts

1 comment

  1. On your site I see the gallery inside entry-content block, but it commented and it is not shown for this reason.

    See code below:

    <div class="entry-content">
      <!--<div class="gmedia_gallery phantom_module" id="GmediaGallery_3" data-gallery="3" data-module="phantom"> ... </div>-->
    </div>
    

    On other page (for example here) your content displaying twice: first commented, but second without comments and displaying normally.

    Try to check the_content() function in your single.php or content-page.php.

    This might help.

    UPDATE 1

    Here code which duplicates content of the pages. File contentPost.php [ line:47 ]:

    <!--<?php the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>-->
    

    This code must be removed or commented properly:

    <?php //the_content(__('Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme')); ?>
    

    I’am activate your theme and create post with test gallery http://template.dev-city.me/gallery/

    UPDATE 2

    More about WordPress theme development.

Comments are closed.