This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.video-container { | |
position: relative; | |
padding-bottom: 56.25%; /*16:9*/ | |
padding-top: 30px; | |
height: 0; | |
overflow: hidden; | |
} | |
.video-container iframe, | |
.video-container object, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'rest_endpoints', function( $endpoints ){ | |
if ( ! isset( $endpoints['/wp/v2/posts'] ) ) { | |
return $endpoints; | |
} | |
unset( $endpoints['/wp/v2/posts'][0]['args']['per_page']['maximum'] ); | |
return $endpoints; | |
}); | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sort array of objects by items value ('jobId') | |
data.sort((a, b) => { | |
if (a.jobId > b.jobId) { | |
return -1 | |
} else if (a.jobId < b.jobId) { | |
return 1 | |
} else { | |
return 0 | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------------------------------------------------- | |
/** | |
* Logging to debug.log in DEBUG_LOG_DIR dir (default is the root site dir) | |
* | |
* Note: You can define in the wp-config.php: | |
* 1) define( 'DEBUG_LOG_DIR', dirname( __FILE__ ) . '/' ); | |
* 2) define( 'DEBUG_LOG_INVERTED', false); | |
* | |
* Author K |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp_enqueue_script( 'wp-rest', get_template_directory_uri() . '/js/wp-rest.js', null, null, true ); | |
// Posts custom fields | |
function prepare_rest($data, $post, $request){ | |
$_data = $data->data; | |
$_data['custom_fields'] = get_post_meta($post->ID); // retrieving all post meta fields | |
return $_data; | |
} | |
add_filter('rest_prepare_post', 'prepare_rest', 10, 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_customize_rest_cors() { | |
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
add_filter( 'rest_pre_serve_request', function( $value ) { | |
header( 'Access-Control-Allow-Origin: *' ); | |
header( 'Access-Control-Allow-Methods: GET' ); | |
header( 'Access-Control-Allow-Credentials: true' ); | |
header( 'Access-Control-Expose-Headers: Link', false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in \system\library\currency.php | |
// change | |
if (($symbol_right) && ($format)) { | |
$string .= $symbol_right; | |
} | |
// to | |
if (($symbol_right) && ($format)) { | |
$string .= '<span class="currency-symbol">' . $symbol_right . '</span>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The solution is to use event delegation (jquery's ".on()" method) from outside of the carousel's top element | |
(with the "slick-slider" class), targeting the elements inside the carousel. | |
This way the event handler is unaffected by the bug. | |
Example: | |
$('.carousel-container').on('click', 'div.button', function() { | |
// do stuff | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mocks react-beautiful-dnd Droppable without the need of a DragDropContext etc. | |
jest.mock('react-beautiful-dnd', () => ({ | |
Droppable: jest.fn( | |
// params to children are `provider`, `snapshot` | |
({children}) => children({}, {}) | |
) | |
})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Checkbox extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
checked: false | |
}; | |
this.handleClick = this.handleClick.bind(this); | |
} |