Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: How to load js files in header only on listing pages?

  1. #1
    Thread Starter
    Senior Member edwin's Avatar
    Join Date
    Nov 2010
    Location
    Netherlands
    Posts
    117
    Thanks
    3
    Thanked 22 Times in 17 Posts

    How to load js files in header only on listing pages?

    I'm using this functions.php code to try to load specific .js files in the header when a ClassiPress listing page is being viewed:

    PHP Code:
    function my_enqueue_scripts() {

            
    wp_register_script'js-1'get_stylesheet_directory_uri() . '/js/1.js);
            
    wp_register_script'js-2'get_stylesheet_directory_uri() . '/js/2.js);
            
    wp_register_script'js-3'get_stylesheet_directory_uri() . '/js/3.js);
            
    wp_register_script'js-4'get_stylesheet_directory_uri() . '/js/4.js);
            
    wp_register_script'js-5'get_stylesheet_directory_uri() . '/js/5.js);

        if( 
    is_page_template'single-ad_listing.php' ) ) :

            
    wp_enqueue_script'js-1'get_stylesheet_directory_uri() . '/js/1.js);
            
    wp_enqueue_script'js-2'get_stylesheet_directory_uri() . '/js/2.js);
            
    wp_enqueue_script'js-3'get_stylesheet_directory_uri() . '/js/3.js);
            
    wp_enqueue_script'js-4'get_stylesheet_directory_uri() . '/js/4.js);
            
    wp_enqueue_script'js-5'get_stylesheet_directory_uri() . '/js/5.js);

        endif;

    }

    add_action'template_redirect''my_enqueue_scripts' ); 
    But for some reason Classipress doesn't want to comply here and load the .js files.

    What else is required?

  2. #2
    bbocioaca's Avatar
    Join Date
    Jul 2012
    Location
    Buzau, Romania
    Posts
    160
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. #3
    Thread Starter
    Senior Member edwin's Avatar
    Join Date
    Nov 2010
    Location
    Netherlands
    Posts
    117
    Thanks
    3
    Thanked 22 Times in 17 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    bbocioaca's Avatar
    Join Date
    Jul 2012
    Location
    Buzau, Romania
    Posts
    160
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    Thread Starter
    Senior Member edwin's Avatar
    Join Date
    Nov 2010
    Location
    Netherlands
    Posts
    117
    Thanks
    3
    Thanked 22 Times in 17 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #6
    bbocioaca's Avatar
    Join Date
    Jul 2012
    Location
    Buzau, Romania
    Posts
    160
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #7
    Thread Starter
    Senior Member edwin's Avatar
    Join Date
    Nov 2010
    Location
    Netherlands
    Posts
    117
    Thanks
    3
    Thanked 22 Times in 17 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #8
    bbocioaca's Avatar
    Join Date
    Jul 2012
    Location
    Buzau, Romania
    Posts
    160
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #9
    Thread Starter
    Senior Member edwin's Avatar
    Join Date
    Nov 2010
    Location
    Netherlands
    Posts
    117
    Thanks
    3
    Thanked 22 Times in 17 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #10
    bbocioaca's Avatar
    Join Date
    Jul 2012
    Location
    Buzau, Romania
    Posts
    160
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. add new listing confirm page wil not load.
    By wilph in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: October 14th, 2011, 07:53 AM
  2. How to align pages in the top header?
    By aubertin in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: September 30th, 2011, 05:31 AM
  3. different header image (logo) on each site load
    By lumicon in forum JobRoller General Discussion
    Replies: 9
    Last Post: July 31st, 2011, 07:42 AM
  4. [SOLVED] Search module in my header, like on the PSD's files
    By alphanice in forum ClassiPress General Discussion
    Replies: 2
    Last Post: September 22nd, 2010, 02:24 AM
  5. Replies: 4
    Last Post: July 13th, 2010, 09:48 AM