• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom page template loading issue

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Custom page template loading issue

This topic is: not resolved

Tagged: genesis_loop, hooks, jquery

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 10 months ago by ericjamesauthor.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 30, 2015 at 5:04 pm #149675
    ericjamesauthor
    Member

    Hi, I have a JQuery page-flip plugin. Today I read that one way to get it to work on a WordPress site is to create a custom page template , which I've done. I queued & loaded in my scripts, copied over the HTML and placed it my custom genesis_loop function and found that the plugin was working. Here it is (note: this may or may not work on your machine, as I think that depends on how quickly the page loads) http://ericjames.co.uk/maxslittlebrother/

    So you can click the page corners of the book and the pages flip, but some shading is missing - no huge deal for now. However, then I removed an extraneous image (the big red 'splat' that you can see at the bottom of the page when the book is closed), and everything stopped working. I put the image back and the page started loading again.

    So I guess it's some kind of loading order issue - perhaps the main page content loads in before the javascript/CSS has finished loading in - but when the 'splat' image loads too it delays everything by a few milliseconds, enough to ensure everything loads in the correct order - on my machine at least. Obviously I need to sort it, but I'm unsure of exactly what to do now.

    Here's how I load my scripts (yes, my js & css should probably be moved, but I'm just focusing on getting things working first):

    function template_scripts() {
    	wp_deregister_script('jquery');
    	wp_register_script('jquery', get_stylesheet_directory_uri() . '/my-templates/js/jquery-1.7.1.min.js', '1.7.1');
    	wp_enqueue_script('jquery');
    	wp_enqueue_script( 'wow', get_stylesheet_directory_uri() . '/my-templates/js/wow_book.min.js', array('jquery'), '', false );
    	wp_enqueue_style( 'wowcss', get_stylesheet_directory_uri() . '/my-templates/wow_book/wow_book.css' );
    }
    add_action( 'wp_enqueue_scripts', 'template_scripts' );

    And all of the HTML, and the JavaScript block that sets up the book are within my custom genesis loop:

    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'my_custom_loop' );

    I can't seem to load the book any later than after the genesis_loop fires, and I don't think I can (or should) load the scripts any earlier - you'll see that the wow_book.min.js enqueue script has a final argument of false, meaning it loads in the header, not the footer - this didn't make any difference though. Without the 'splat' image the page still failed to load properly (the images load in but the book has no shading and is not clickable.)

    I'd like to understand what may be going wrong here, even if you think that a custom page template isn't the ideal way to approach this (if I should be doing this a different way feel free to tell me that too - I'm a complete novice with this kind of WordPress and Genesis stuff, so it may be easier to see if I can get this working for now!

    http://ericjames.co.uk/maxslittlebrother/
    May 2, 2015 at 8:14 am #149809
    Brad Dalton
    Participant

    You could load the scripts directly from the template. Not normally done that way in genesis but something you could try.


    Tutorials for StudioPress Themes.

    May 6, 2015 at 1:50 am #150323
    ericjamesauthor
    Member

    Thank you

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble