That’s a great idea! thank u very much!
Oh, now i got it. the problem seem to be with my rows that are added by jquery.
If i use your code with a row already exists it works, but on my code i add rows with jquery this way (to pull videos from youtube channel into those rows…):
$(document).on('mouseup','.get_yt_videos_from_channel',function(e){
var ycLink = $('[data-name="yt_channel_url"] input').val();
var channelID = ycLink.split("/")[4];
// If has youtube channel
if(channelID){
$.get(
"https://www.googleapis.com/youtube/v3/search",{
part : 'snippet',
channelId : 'UCtGv4fb0btvvi9pGOt0UrEA',
type : 'video',
key: 'AIzaSyB_VnQhWmlxX0Z9kH_s3bejItXt04lYb6w'},
function(data) {
$.each( data.items, function( i, item ) {
$('[data-key="field_602ea4a8fe1ab"] a[data-event="add-row"]').last().trigger('click');
var addedRow = $('[data-key="field_602ea4a8fe1ab"] .acf-clone').prev();
addedRow.find('[data-name="yt_title"] input').val(item.snippet.title);
addedRow.find('[data-name="yt_url"] input').val('https://www.youtube.com/watch?v='+item.id.videoId);
})
}
);
$(document).find('input').trigger('change');
}
// If doesn't have youtube channel - alert Error
else {
alert('You don't have a youtube channel url defined');
}
And when added like that the preview won’t load even i then type it manually into to the ‘.input-search’.
Any idea why?
Thanks John,
It doesn’t seem to work for me. do you see a video thumbnail when you click?
Did you find a solution?
Does it work for you if you only save the post at the back end without adding anything?
Does it work for you if you only save the post at the back end without adding anything?
I can try to help, but i need some details about how you setup everything, you write very short and vaguely…
What is the output you need?
Sorry, “Prepend” in your case.
Don’t dig too deep 🙂
It’s Append.
So ill ask again 🙂
Why don’t use the prefix option?
It will apply to every phone out there and he won’t be bale to change it.
Does he have access to the ACF Admin? (and if he does, can’t you just block it? Very good plugin here btw)
What i mean is using the simple “prefix” option in the field options, without using code at all.
What are you trying to do?
Why don’t use the prefix option?
I need this also 🙂
Thanks, but the priority thing doesn’t work. btw – it’s the same thing with a number field type also.
Sorry – It will echo the original format date.
Got it – Need to check $field['name']
value.
but how will i get the value of the created post ACF field?
The post is created by a user using formidable pro form which his fields are connected to the ACF fields of the post.
Once the post is created i get a mail saying there is a new post and i have a link to publish.
The link is a link to a page which uses is own template php file. in that php file i use that code:
<?php $thispropostid = $_GET[‘thispropostid’]; $postData = [ ‘ID’ => $thispropostid, ‘post_status’ => ‘publish’ ]; wp_update_post( $postData );?>
To publish the post.
Obviously the $_GET['thispropostid'];
is getting the post id from the url attribute which holds the post’s id.
That’s it. that’s the whole story… Nothing more.
Thanks, but actually now i see my problem is more serious, until i don’t manually press “publish” / “update” on the post edit page the ACF fields don’t return anything…
Can you share how to do that? i really need it too 🙂
Thanks anyway.
Tried to deactivate and activate my two plugins (only acf and the post type plugin) and tried switching to Twenty Fifteen. nothing is changed..
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.