How do I change number of columns in a proper way in twentyfourteen child theme?
I'm trying to deactive and reactive a javascript in my childtheme - from the twentyfourteen theme (so updates won't effect things).
What I really want to do is to change column width from 4 to 3 in the footer but I don't want to change /js/functions.js directly in the main theme (maybe there is another/better way achieving this. please tell!)
I'm putting this in functions.php in the child-theme:
/* activate and decative js class */
class aadjs {
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'deactivejs'), 100 );
}
public function deactivejs() {
wp_dequeue_script( 'twentyfourteen-script' );
add_action( 'wp_enqueue_scripts', array( $this, 'reactivatejs'), 100);
}
//Why isn't this function executed?
public function reactivatejs() {
echo get_stylesheet_directory_uri() . '/js/functions.js';
exit;
wp_enqueue_script( 'twentyfourteen-script', get_stylesheet_directory_uri() . '/js/functions.js', array( 'jquery' ), '20140616', true );
}
}
$x = new aadjs();
I want to deactive js and then reactive js but reactivatejs is not called. What am I doing wrong? The path to the new js file in the child-theme is set correctly and it does exist.
The /js/functions.js I want to change:
_window.load( function() {
// Arrange footer widgets vertically.
if ( $.isFunction( $.fn.masonry ) ) {
$( '#footer-sidebar' ).masonry( {
itemSelector: '.widget',
columnWidth: function( containerWidth ) {
return containerWidth / 4;
},
gutterWidth: 0,
isResizable: true,
isRTL: $( 'body' ).is( '.rtl' )
} );
}
} );
TO (notice the 3)
_window.load( function() {
// Arrange footer widgets vertically.
if ( $.isFunction( $.fn.masonry ) ) {
$( '#footer-sidebar' ).masonry( {
itemSelector: '.widget',
columnWidth: function( containerWidth ) {
return containerWidth / 3;
},
gutterWidth: 0,
isResizable: true,
isRTL: $( 'body' ).is( '.rtl' )
} );
}
} );
Topic theme-twenty-fourteen child-theme Wordpress javascript
Category Web