How to change only one javascript function in wordpress child theme?

I would like to change just one JavaScript function in the child theme but without having to insert all the JavaScript code of the parent theme.

How do I change only this function (I need change only count = Math.ceil(width / size) line):

function slickAutoResponsive(slider, max, size) {    if (!max){     max = 5;   }   if (!size){     size = 380;   }    var width = slider.width(),     count = Math.ceil(width / size);    if (count < 1) count = 1;   if (count > max) count = max;    return count; } 

How to make child object a member of two parents in unity?

So I have an parent game object that has multiple objects.

This format is desirable:

-GameObject     -object1 (abstract)         -subobject1      -object2 (abstract)         -subobject2      -object3 (abstract)         -subobject1         -subobject2 // There are two objects in the scene, subobject1 and subobject2 

The problem is when i drag and drop one subobject from an object it removes it from the other object. When i copy the subobjects to another object, there are now two.

I hope this makes sense.

twentysixteen child theme – responsive menu – ham icon button not working – Cannot read property ‘classList’ of null

I am trying to convert this site into twentysixteen child theme. It appears that /js/menu.js in my child theme is not working as nothing happens when the ham icon button is clicked (pls.see my site link above to check correct behavior). On inspecting via Google Chrome Inspect I am getting the following errors:

Uncaught TypeError: Cannot read property ‘classList’ of null at mediaqueryresponse (menu.js?ver=5.3.2:19) at menu.js?ver=5.3.2:10 at menu.js?ver=5.3.2:31 mediaqueryresponse @ menu.js?ver=5.3.2:19 (anonymous) @ menu.js?ver=5.3.2:10 (anonymous) @ menu.js?ver=5.3.2:31

Any advice is appreciated

header.php in child theme

<header class="header" id='myTopnav'>  <?php  wp_nav_menu(              array(                   'theme_location'=> 'topnav',                   'container' => 'nav',                   'menu_class' => 'topnav',                   'menu_id'    => 'myTopnav',                   )  );?>  <button class="ham-icon"><span class="fa fa-bars fa-2x"></span></button>  </header> 

/js/menu.js in child theme

(function () {   var mql = window.matchMedia("screen and (max-width: 960px)");   //detect media query    var navTop = document.querySelector(".header");   //return first element within the document that matches .header    var toggle = document.querySelector(".ham-icon");    mediaqueryresponse(mql);   //ensures that addListener function is executed when the page loads, by default addListener only fires when state of the window changes   mql.addListener(mediaqueryresponse);    function mediaqueryresponse(mql) {     if (mql.matches) {       toggle.addEventListener("click", clickMenu);       //if media query matches, execute click or clickMenu event     } else {       navTop.classList.remove("responsive");       //otherwise remove .responsive       toggle.removeEventListener("click", clickMenu);       //and remove EventListener     }    }    function clickMenu() {     navTop.classList.toggle("responsive");   }  })(); 

finding the parent index in an interval heap (stored on an array) given a child index

an interval heap is a binary tree stored on an array where the size of each node is 2.

i would like to be able to find the index of a parent and find one of the child indices given the index of a node.

an example of an interval trees indices would be:

         [0,1]      [2,3]     [4,5]  [6,7][8,9][10,11][12,13] 


         [1,2]      [3,4]     [5,6]  [7,8][9,10][11,12][13,14] 

Genesis Child Theme – Customize body

So I created a custom post type and I’ve also created a custom page called page-profile.php that follows the WordPress templating.

Here is the code inside page-profile.php:

<?php  $  args = array(     'post_type' => 'profile', // enter custom post type     'orderby' => 'title',     'order' => 'ASC',     'posts_per_page' => '4', ); $  loop = new WP_Query($  args);  get_header(); // displays header get_sidebar(); get_footer(); //displays footer 

So the header, footer and sidebar all are being called in.

How can I target the red box and create templating where I would like to show the title and thumbnail?

enter image description here

Retrieve images from parent site to child site using current shortcodes

I have a WordPress network setup, with a parent site and a few other child sites within it. I have a custom plugin that saves content (images & posts) to a list for each user on my parent site. I also have a custom admin menu that reveals the image list via a user dropdown on my main site. I have shortcode on my parent site that reveals a user’s favorite image list by user_id.

What I’m trying to accomplish is to change the code of this custom plugin so that the lists appear on the child site/subsite via the shortcode used on the parent site. I imagine that the site_id needs to be passed through this shortcode to make it possible. I also have the custom admin menu on my subsite with the user dropdown, however, the images do not appear when I click to see those favorites.

Now I’ll preface this and say I’m not an experienced programmer but my research leads me to believe that I need to modify the code that controls the menu so it can pull the content (i.e. Media library images/attachments/attachment URLs for that post ID) from the main site to the subsites and add a shortcode and function that makes the parameter for site_id possible.

Does anyone know what query/code/function that I would use retrieve this content from the main site to the subsite so that the image lists would appear in a shortcode form and within my admin menu?

I’ve already tried plugins that allow you to sync the Media Library but they don’t work for what I’m trying to accomplishs

If you need examples of what is already established, such as current codes, shortcodes and images, I’d be happy to oblige.

setInterval is not working in child js file

I am trying to use setInterval() into a script.js in a child theme. that was added in the functions.php child, any console.log() is working so the file is well linked. this is how I am using the method:

var itemSlider = document.getElementsByClassName("slider-item"); var a = 0; var time = 3000; var interval;  for (var i = 0; i < itemSlider.length; i++) {   itemSlider[i].style.display = "none"; }  function activateBlock () {   if(a < itemSlider.length){     console.log(interval);     if (a === 0) {       itemSlider[a].style.display = "block";     } else if (a < itemSlider.length) {       itemSlider[a - 1].style.display = "none";       itemSlider[a].style.display = "block";     } else {       a = 0;     }   }   a++; } activateBlock(); interval = setTimeut(activateBlock, time); 

When I see in the Chrome debugger instead of calling the function just continues with the next code.

debugger in setInterval debugger continue without calling the function

Maybe the logic of the code is not well implemented but what I am trying to achieve in this stage is just setInterval call repeatedly the function. This is my first project creating a child theme, any help would be appreciated.