Title: The difference between two almost similar enqueue codes
Last modified: August 30, 2016

---

# The difference between two almost similar enqueue codes

 *  Resolved [Koesterandersen](https://wordpress.org/support/users/koesterandersen/)
 * (@koesterandersen)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/the-difference-between-two-almost-similar-enqueue-codes/)
 * According to some closed threads I have a question, that I hope someone could
   answer.
 * Can anyone tell me the difference of these two enqueue codes.
 * Nr. 1
    function my_enqueue_parent_theme_styles() { wp_enqueue_style( ‘parent-
   style’, get_template_directory_uri().’/style.css’ ); } add_action( ‘wp_enqueue_scripts’,‘
   my_enqueue_parent_theme_styles’);
 * Nr. 2
    add_action( ‘wp_enqueue_scripts’, ‘enqueue_parent_theme_style’ ); function
   enqueue_parent_theme_style() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri().’/
   style.css’ ); }
 * They both seem to work, but I wonder why there are two different ones. And then
   I think that maybe one of them might not work suddenly in a particular situation.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * (@bdbrown)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/the-difference-between-two-almost-similar-enqueue-codes/#post-6226739)
 * Hi Koesterandersen. Seems to be a bit of cross-posting regarding your question.
   Once you started [this post](https://wordpress.org/support/topic/child-theme-import-import-function-versus-enqueue?replies=2)
   you should have kept that thread active. The reference I gave you in that post
   to look at [this post](https://wordpress.org/support/topic/alternative-to-import-in-hueman-child-themes?replies=22)
   was just that; a reference. Since you’ve started another post here with the same
   question you should edit your [original post](https://wordpress.org/support/topic/child-theme-import-import-function-versus-enqueue?replies=2)
   with a link to this post, then mark your original post as Resolved.
 * To answer your question, the two code segments are equivalent. The difference
   is that one declares the add_action before the function, the other declares it
   after the function. It’s just a matter of coding style; they both do the same
   thing.
 *  Thread Starter [Koesterandersen](https://wordpress.org/support/users/koesterandersen/)
 * (@koesterandersen)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/the-difference-between-two-almost-similar-enqueue-codes/#post-6226745)
 * Hi bdbrown
 * Thank you for your answers.
 * Now when I have messed up in different threads today I might have learned (by
   accident) how the rules are here in the forum. And with your explanation I can
   see now, how the forum works. I will try to remember to do it right in the future.
 * And thank you for the answer about the difference of the two enqueue functions.
   Now I have peace in my mind when it comes to this function.
 * Have a nice weekend
 * And thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘The difference between two almost similar enqueue codes’ is closed to
new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/hueman/3.7.27/screenshot.png)
 * Hueman
 * [Support Threads](https://wordpress.org/support/theme/hueman/)
 * [Active Topics](https://wordpress.org/support/theme/hueman/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/hueman/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/hueman/reviews/)

## Tags

 * [Codes](https://wordpress.org/support/topic-tag/codes/)
 * [different](https://wordpress.org/support/topic-tag/different/)
 * [enqueue](https://wordpress.org/support/topic-tag/enqueue/)

 * 2 replies
 * 2 participants
 * Last reply from: [Koesterandersen](https://wordpress.org/support/users/koesterandersen/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/the-difference-between-two-almost-similar-enqueue-codes/#post-6226745)
 * Status: resolved