
수원 화성

안녕하세요.
WordPress의 기본 REST API중 posts에는 따로 댓글의 카운트를 따로 뽑아주는 기능이 없어 검색해보니..
역시나 누군가 만들어둔게 있어 퍼옵니다.
WordPress /wp-content/themes/{사용 테마}
폴더의 functions.php에 추가후 확인
// https://stackoverflow.com/a/60048982
add_action( 'rest_api_init', function() {
register_rest_field( 'post', 'comment_count', [
'get_callback' => function ( $post ) {
return (int) wp_count_comments( $post['id'] )->approved;
},
'schema' => [
'description' => 'List number of comments attached to this post.',
'type' => 'integer',
],
] );
});
const listener = () => {
const MIN_KEYBOARD_HEIGHT = 300
const isMobile = window.innerWidth < 768
const isKeyboardOpen = isMobile && window.screen.height - MIN_KEYBOARD_HEIGHT > window.visualViewport.height
document.documentElement.classList.toggle('show-keyboard', isKeyboardOpen)
}
window.visualViewport.addEventListener('resize', listener)
android 4.*버전의 android 브라우저에서 -webkit-appearance
사용시 video태그의 기본 컨트롤의 스타일이 무너지는 현상
html 셀렉터를 이용하여 해결필요
[css]
html input[type="button"] {
-webkit-appearance: none
}
[/css]
몇몇 안드로이드에서 touchstart
같은 touch전용 이벤트가 걸린 엘리먼트 위에 pointer-events: none;
가 걸린 엘리먼트를 위에 띄울경우 touch이벤트가 안먹는 문제가 발생.
n | 2n+1 | 4n+1 | 4n+4 | 4n | 5n-2 | -n+3 |
---|---|---|---|---|---|---|
0 | 1 | 1 | 4 | – | – | 3 |
1 | 3 | 5 | 8 | 4 | 3 | 2 |
2 | 5 | 9 | 12 | 8 | 8 | 1 |
3 | 7 | 13 | 16 | 12 | 13 | – |
4 | 9 | 17 | 20 | 16 | 18 | – |
5 | 11 | 21 | 24 | 20 | 23 | – |
머리가 안돌아가서 적어둠….