No one?
Bump!
Bizarre – I’ve just gone back into the admin section and now it is fine!
Hi,
I’ve done all that and unfortunately it’s the visual composer that comes with the theme that seems to trigger it.
JJ
Thanks – but I need unique articles, I really don’t want duplicates everywhere. Is there no alternative?
I found that there is a function being called when you add a post that parses the content and processes the shortcode
Managed to find it and it now works – here is my very specific solution
<h3>Videos</h3>
<?php
$videos = get_posts(array(
'post_type' => 'post',
'category' => 53,
'meta_query' => array(
array(
'key' => 'article_event', // name of custom field
'value' => '"'.get_the_ID().'"', // matches exaclty 123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
//echo get_the_ID();
if( $videos ):
$vID = '';
$vArray = array();
foreach( $videos as $video ):
$vID .= get_field( "article_video_id", $video->ID ) .',';
$vArray[] = get_field( "article_video_id", $video->ID );
endforeach;
endif;
$vID = rtrim($vID, ',');
function jj_get_video_info_data ($array_param){
$list_to_parse = $array_param;
$list_to_parse = explode(',', $list_to_parse);
$buffy = array();
//echo $list_to_parse;
foreach($list_to_parse as $id_video) {
$id_video = trim($id_video);//possible to have spaces
//echo '['.$id_video.']';
$response = wp_remote_get('https://www.googleapis.com/youtube/v3/videos?id=' . $id_video . '&part=id,contentDetails,snippet&key=AIzaSyBneuqXGHEXQiJlWUOv23_FA4CzpsHaS6I', array(
'sslverify' => false
));
if (is_wp_error($response)) {
break;
}
$data = wp_remote_retrieve_body($response);
if (is_wp_error($data)) {
break;
}
$obj = json_decode($data, true);
$buffy[$id_video]['thumb'] = td_global::$http_or_https . '://img.youtube.com/vi/' . $id_video . '/default.jpg';
$duration = $obj['items'][0]['contentDetails']['duration'];
if (!empty($duration)) {
preg_match('/(\d+)H/', $duration, $match);
$h = count($match) ? filter_var($match[0], FILTER_SANITIZE_NUMBER_INT) : 0;
preg_match('/(\d+)M/', $duration, $match);
$m = count($match) ? filter_var($match[0], FILTER_SANITIZE_NUMBER_INT) : 0;
preg_match('/(\d+)S/', $duration, $match);
$s = count($match) ? filter_var($match[0], FILTER_SANITIZE_NUMBER_INT) : 0;
$buffy[$id_video]['title'] = $obj['items'][0]['snippet']['title'];
$buffy[$id_video]['time'] = gmdate("H:i:s", intval($h * 3600 + $m * 60 + $s));
}
}
if(!empty($buffy)) {
return $buffy;
} else {
return;
}
}
$td_playlist_video['youtube_ids'] = jj_get_video_info_data($vID);
$td_playlist_video['youtube_title'] = 'Whatever';
//print_r($td_playlist_video);
update_post_meta(get_the_ID(),'td_playlist_video',$td_playlist_video);
$videoSC = '[vc_row][vc_column][td_block_video_youtube playlist_title="TITLE" playlist_yt="'.$vID.'"][/vc_column][/vc_row]';
echo do_shortcode($videoSC);
?>
Is it the case that it only works upon a post submit and not when hard-coded in the template?
Is there anyway around this?
This looks exactly like I want! Any chance it will be featured as part of the core theme soon?
Sorted – just needed to add the title!
However we still have the issue of the category title within the image dropping down a few pixels. Any advice?
Hi,
I’ve tried that but it doesn’t work. I read somewhere on the official plugin thread that it isn’t allowed due to security…. shame
JJ
It works when I use it in
page.php
but not in
single.php
or any copy of it.
The shortcode works outside the editor when it is actually included within the editor!!!
Also
[vc_row][vc_column][vc_images_carousel images="115119,115038,115036,115035"][/vc_column][/vc_row]
works fine so it seems to be an issue with
vc_media_grid
-
This reply was modified 10 years by
JanuszJasinski.
-
This reply was modified 10 years by
JanuszJasinski.
Thanks
I’ve achieved it by creating single-event.php and then using loop-event.php within it, both customised.
Again, would be ever so useful to set this in the front end rather than editing files
Hi,
Thanks for this. This is what I’ve done but it would be excellent if the theme had a lot more support for custom post types.
JJ
Excellent – that workaround will be fine for now
Thanks
Apologies – seen this has been requested already. Any guidance on how to accomplish it would be awesome, even if it means updating the DB ourselves
Hi,
Any suggestions as where to look in the DB so we could potentially programatically try ourselves?
Thanks,
JJ
The theme doesn’t have an option to set a template for articles from a specific category, if this is what you mean and you will need custom modifications.
This would be an excellent addition – are there any plans for this in the future, along with the same option for custom post types?