Support » Plugin: WP Photo Album Plus » Problem with wp_print_scripts

  • Resolved lukuna

    (@lukuna)


    Hi,
    I’m using Twenty-Fourteen template and last WP. I had a serious problem after installing last WPPA+ update – no WPPA+ comments, slides and other features on my pages. I tried to investigate it and I found a problem with new style registering of scripts via wp_print_scripts (in wppa-non-admin.php). I have solved it by use “wp_enqueue_scripts” hook instead. Is it problem to use this variant?

    Regards

    Lubos Kuna

    http://www.veselykocour.cz

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Previously i enqueued scripts during init, the recommended place for plugins to set things up as they say.
    I added the feature to skip loading when not needed ( Table IV-A29 ).
    At the time of enqueueing i need to know the value of get_the_ID(), to see if loading js is needed.
    get_the_ID() does not know the page yet during init, but does know it during wp_print_scripts, so i started doing it during wp_print_scripts. I just tested that during wp_enqueue_scripts ( == before wp_head ) it also works ( i do not know when get_the_ID() gets its value ), so it may be changed to wp_enqueue_scripts without problems, and i will do that in the next version. Thanx for your report, and sorry for the inconvenience.

    BTW. There seems not to be an analogue of wp_print_styles: wp_enqueue_styles is not mentioned on https://codex.wordpress.org/Plugin_API/Action_Reference

    Hi again,
    I think, I found problem (maybe). I examined the source code of function wppa_add_javascripts() – source for wp_print_scripts() and I noticed that action wp_enqueue_script() is called from this function. I had “déja vu” – I met the same problem in my work a few time ago and I spent time with identifying this :-). I hope it can help You.

    Action wp_enqueue_script() should not be called from inside wp_print_scripts().

    I found in my friend Google (for example):

    Use wp_enqueue_scripts, not wp_print_styles, to enqueue scripts and styles for the frontend


    http://stackoverflow.com/questions/6772622/wp-enqueue-script-in-action-hook-wp-print-scripts

    best regards

    Lubos

    • This reply was modified 2 years, 7 months ago by  lukuna.
    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Thanx, especially for:

    Don’t let the names fool you — they are for both scripts and styles

    It will be changed accordingly. Have a nice day.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problem with wp_print_scripts’ is closed to new replies.