[wp-trac] [WordPress Trac] #46036: Using of wp_register_script , wp_enqueue_script and wp_enqueue_style to add scripts of a plugin (Gravity Forms) in a custom theme is not working

WordPress Trac noreply at wordpress.org
Fri Jan 18 13:56:32 UTC 2019


#46036: Using of wp_register_script , wp_enqueue_script and wp_enqueue_style to add
scripts of a plugin (Gravity Forms) in a custom theme is not working
----------------------------------------+-----------------------------
 Reporter:  justinahinon                |      Owner:  (none)
     Type:  defect (bug)                |     Status:  new
 Priority:  normal                      |  Milestone:  Awaiting Review
Component:  Plugins                     |    Version:  5.0.3
 Severity:  minor                       |   Keywords:  needs-testing
  Focuses:  template, coding-standards  |
----------------------------------------+-----------------------------
 I've tried several times to add styles and script from Gravity Forms to
 the functions.php file of a custom theme I'm building.

 Here's the piece of code I'm using

 {{{#!php
 <?php
 function add_gravity_forms_scripts() {
     // The gravity forms folder is placed on the custom theme main folder

     wp_enqueue_style('gravity_forms_css', get_template_directory_uri() .
 '/gravityfomrs/css/formsmain.min.css' , '', false);

     wp_enqueue_script('gravity_forms_script', get_template_directory_uri()
 . '/gravityfomrs/js/forms.min.js' , '', false);
  }
  add_action( 'wp_enqueue_scripts', 'add_gravity_forms_scripts' );
 ?>
 }}}

 The gravity form is directly added to a page using the gravity forms
 function call:

 {{{#!php
 <?php
 gravity_form( $id_or_title, $display_title = true, $display_description =
 true, $display_inactive = false, $field_values = null, $ajax = false,
 $tabindex, $echo = true );
 ?>
 }}}


 I tried the same methods on a new custom theme and still having the same
 issue: **the styles and scripts didn't loaded lke the wp_enqueue function
 is not working**

 I'm using the last WordPress version (5.0.3) on an online server.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46036>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list