0

I am pretty new as WordPress developer and I am going crazy with a theme developed by myself starting from 0.

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

On this website I have tryed to install an image gallery plugin named GMedia Gallery (I have tryed 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:

Appereance --> 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 appera 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 perfrectly shown into the page, here a screenshot that proves this asserion:

enter image description here

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

I really have no idea about the reason of this problem. I thinked that maybe coul 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?

Tnx so much

  • You do not need to load jQuery in theme. WordPress loads it automatically Just remove this line wp_enqueue_script('jquery') and keep the jquery in dependency as it is. – Sumit Feb 28 '16 at 12:02
  • @Sumit ok but do you think that this could be the cause of my problem? – AndreaNobili Feb 28 '16 at 12:03
  • Of course not! But it is wrong to include jQuery in WordPress. About the issue I can see gallery HTML is comment in post_content not sure how! – Sumit Feb 28 '16 at 12:35
  • @Sumit mmm I have not understand what do you mean. Where do you see that the comment in the post_content ? – AndreaNobili Feb 28 '16 at 12:37
  • 1
    Please see the page HTML source. You will see gallery HTML is commented and if I remove comment by web inspector then I can see the gallery! – Sumit Feb 29 '16 at 4:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.