badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

ilayxz

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • ilayxz
    Participant

    Thank you very much

    in reply to: The JavaScript for Accordion does not work #44711
    ilayxz
    Participant

    I created a child theme and accordion.js is a javascript, which is in folder interface-child\js located.
    So; interface-child/js/accordion.js.

    Am I to use the following code at interface-child/functions.php to Loading the javaScript: (?)

    add_action( 'wp_enqueue_scripts', 'interface_enqueue_accordion' );
    function interface_enqueue_accordion() {
        wp_enqueue_style( 'interface', get_template_directory_uri() . '/accordion.js' );
    
    }

    I think, it said to be ‘js/accordion.js’ instead of ‘/acoordion.js’. But it doesn’t work in both case.

    Thank you

    ilayxz
    Participant

    Thank you for your answer.

    My child-theme work normally impeccable. Every time I have problem, if a subfolder come into question (like the sidebar-extensions.php, it is located at interface-child\inc\structure – Folder).

    I’d quite like to learn code customization self. Could you please recommend me a link for learn it?

    Thank you very much!

    in reply to: The JavaScript for Accordion does not work #44622
    ilayxz
    Participant

    Thank you very much for your recommendation! It has very helped! 🙂

    First I did my script code at interface-child/header.php inserted. So It works marvellous!

    But than I was going to enqueue it from functions.php to head section.

    Thereto I made the following steps:

    1. In interface-child/header.php in <head>-area the following code inserted:
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
    2. A new javaScript created: accordion.js in file interface-child/js:
      $(document).ready(function(){
                      $("dt").click(function(){
                          $('dd').slideUp("fast");
                          $('dt > a').removeClass('open').addClass("closed");
                          $(this).next("dd").slideDown("fast");
                          $(this).children("a").removeClass('closed').addClass("open");
                      });
                  });
    3. To Loading the scripts properly in WordPress, I did pasted the following code in my child-theme’s functions.php file:
      function wp_interface_scripts() {
                      wp_register_script('my_accordion_script', plugins_url('accordion.js', get_stylesheet_directory() . 'js/accordion.js'), array('jquery'),'1.0.0', false);
                      wp_enqueue_script('my_accordion_script');
                  }
                  add_action( 'wp_enqueue_scripts', 'wp_interface_scripts' );

    Unfortunately it doesn’t work. Where do I make mistake?

    Thank you very much again!

    ilayxz
    Participant

    Hello,

    I have a similar problem;

    First all, thank you for hint above. I’ve already created a widget area. To this I have used the functions.php for my child theme:

    register_sidebar( array(
    	'name' 				=> __( 'Unsere Lesitungen Sidebar', 'interface' ),
    	'id' 					=> 'unsere_leistungen_sidebar',
    	'description'   	=> __( 'Shows widgets at Right side for Unsere Leistungen.', 'interface' ),
    	'before_widget' 	=> '<aside id="%1$s" class="widget %2$s">',
    	'after_widget'  	=> '</aside>',
    	'before_title'  	=> '<h2 class="widget-title">',
    	'after_title'   	=> '</h2>'
    ) );

    This works. I see my new area in Dashboard/Design/Widgets on the right side. It name’s “Unsere Lesitungen Sidebar”.

    My problem is the following:
    To register a dynamic sidebar for may widget in this child theme functions.php, I have the following code:

    if ( is_active_sidebar( 'unsere_leistungen_sidebar' ) ) :
        dynamic_sidebar( 'unsere_leistungen_sidebar' );
    endif;

    But it doesn’t work. I’d like to have in my right-sidebar. If I add this code-snippel in the sidebar-extentions-php for Theme interface inside the function interface_display_right_sidebar(), it works. But it must work for my child-theme.

    Can you help me please? Where do I make mistake?

    Thank you in advance

Viewing 5 posts - 1 through 5 (of 5 total)