GET https://www.googleapis.com/youtube/v3/videos?id=sTPtBvcYkO8&key=YOUR_API_KEY&part=statistics
{
"kind": "youtube#videoListResponse",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/XN5YXMZGQaruwTWTekZu7fQthdY\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/QbzZs_aBNpzkZJxTVM7YgQeEY3g\"",
"id": "sTPtBvcYkO8",
"statistics": {
"viewCount": "3215321",
"likeCount": "17003",
"dislikeCount": "263",
"favoriteCount": "0",
"commentCount": "621"
}
}
]
}
$array = array();
$i = 1;
// собираем занчения в массив
while ( $i <= 15 ) {
if ( $field = get_field( 'item' . $i ) ) {
$array[] = $field;
}
$i++;
}
// выводим, если массив не пустой
if ( !empty( $array ) ) {
echo '<ul>';
foreach ( $array as $key => $value ) {
echo '<li>' . $value . '</li>';
}
echo '</ul>';
}
add_filter( 'query_vars', 'add_query_vars' );
function add_query_vars( $qvars ) {
$qvars[] = 'month';
$qvars[] = 'year';
return $qvars;
}
get_query_var()
if ( $month = get_query_var( 'month', false ) ) {
# code...
}
add_query_arg()
$link = add_query_arg( [ 'month' => '11', 'year' => '2021', ], get_home_link() );
if ( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_1',
'title' => 'My Group',
'fields' => array (),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
));
acf_add_local_field(array(
'key' => 'field_1',
'label' => 'Sub Title',
'name' => 'sub_title',
'type' => 'text',
'parent' => 'group_1'
));
endif;