Do not search the image in insert
-
I realized that the image only works if I edit the post and do repost.
I tested on facebook debug and it is 100% see:[ Redundant link removed ]
if you click the button that I made available you will see that it is working only in your plugin that it does not pull image correctly, have any hook that I can do or any idea of yours?
-
This topic was modified 6 years, 11 months ago by
Jan Dembowski.
The page I need help with: [log in to see the link]
-
This topic was modified 6 years, 11 months ago by
-
You must modify your custom post type creation code such that the featured image for the custom post type is available before transition_post_status hook is executed; that is the only solution.
If you could contact our support desk with login credentials,we can look further into your problem and suggest something more.It may take 24 to 48 hours to get response.
I realized that here you insert
$fb_publish_status_insert
I want to know what I have to do here?$ terms = wp_get_post_terms ($ post-> ID, ‘columnist’, array (“fields” => “all”)); foreach ($ terms as $ term) { $ images = get_field (‘image’, $ term-> taxonomy. ‘_’. $ term-> term_id); $ url_image = $ images [‘sizes’] [$ size]; }
If this code provide the custom post type’s image url then assign the image url value to $attachmenturl at publish.php file of WP Facebook Auto Publish(ie
$attachmenturl= $url_image ).
In publish.php file , the plugin fetch the image by calling a function,
$attachmenturl=xyz_fbap_getimage($post_ID, $postpp->post_content);(at line number 222)
So you should append the code after this line and assign the image url to $attachmenturl after line no 222.
Hope this helps.the code below was the implementation I did but it did not work, even setting the url right it does not pull this url see the example
$ attachmenturl = xyz_fbap_getimage ($ post_ID, $ postpp-> post_content);
$ terms = wp_get_post_terms ($ post-> ID, ‘columnist’, array (“fields” => “all”));
$ image = get_field (‘image’, $ term-> taxonomy. ‘_’. $ term-> term_id);
???????????????? $ size = ‘medium’;`$ attachmenturl = ‘https://lagoafm.com.br/wp-content/uploads/cristina.jpg’;`
-
This reply was modified 6 years, 10 months ago by
zsvendo1983.
I did it both ways none worked.
I fixed the image just to make it work and it did not work$ attachmenturl = xyz_fbap_getimage ($ post_ID, $ postpp-> post_content); $ terms = wp_get_post_terms ($ post-> ID, 'columnist', array ("fields" => "all")); $ image = get_field ('image', $ term-> taxonomy. '_'. $ term-> term_id); ???????? $ size = 'medium'; $ attachmenturl = 'https://lagoafm.com.br/wp-content/uploads/jose-andrade-607x480.jpg'; if ($ attachmenturl! = "") $ image_found = 1; else $ image_found = 0;
or
$ attachmenturl = xyz_fbap_getimage ($ post_ID, $ postpp-> post_content); if ($ attachmenturl! = "") $ image_found = 1; else $ image_found = 0; $ terms = wp_get_post_terms ($ post-> ID, 'columnist', array ("fields" => "all")); $ image = get_field ('image', $ term-> taxonomy. '_'. $ term-> term_id); ???????? $ size = 'medium'; $ attachmenturl = 'https://lagoafm.com.br/wp-content/uploads/jose-andrade-607x480.jpg';
-
This reply was modified 6 years, 10 months ago by
zsvendo1983.
$attachmenturl = xyz_fbap_getimage ($post_ID, $postpp-> post_content); $terms = wp_get_post_terms ($post-> ID, ‘columnist’, array (“fields” => “all”)); $image = get_field(‘image’, $term-> taxonomy. ‘_’. $term-> term_id); $size = ‘medium’; $attachmenturl =$image; //if $image is the image url if($attachmenturl!="") $image_found=1; else $image_found=0;
If the custom post type image url is fetched in the variable $image,then the above code might work.
Please cross check whether the variable $image contain the exact url.(echo $image;die; will show the image url value ).
If you are using posting method share a link/attach blog post ,then add the same code at menu.php ,after line number 77.
If the added code works properly,then it might be Facebook cache ,for that check your post url at Facebook Object Debugger .
Hope this helps.see here I fixed an image to show you that it does not work what you told me:
$ terms = wp_get_post_terms ($ post-> ID, 'columnist', array ("fields" => "all")); $ image = get_field ('image', $ term-> taxonomy. '_'. $ term-> term_id); ????????? $ size = 'medium'; == >> $ attachmenturl = 'https://lagoafm.com.br/wp-content/uploads/jose-andrade-607x480.jpg';
Even though the $ attachmenturl variable does not work, something is wrong
I just assigned the url as,
$attachmenturl = 'https://lagoafm.com.br/wp-content/uploads/jose-andrade-607x480.jpg';
at publish.php and menu.php files.
It did work for me,have a look at here, https://prnt.sc/j6v0av
Please check is there any syntax error/ typographical errors,if it doesn’t work for you.
If you could contact our support we can correct it for you.
Hope this helps.I found that in your plugin this foreach does not work, now I do not understand why it would not work
global $ terms; $ terms = wp_get_post_terms ($ post-> ID, 'columnist'); ???????????????????????? foreach ($ terms as $ term) { ???????????????????????? ???????????????? $ image = get_field ('image', $ term-> taxonomy. '_'. $ term-> term_id); ???????????????????????? $ size = 'medium-square'; ?????????????????????? $ attachmenturl = $ image ['sizes'] [$ size]; }
test an image of a category terms in your plugin will see that the foreach does not work because your posts have their own posts-> ID
I sent email to your support was not answered, I added on skype also nothing, online support is always offline, I do not know what else to do ..
$terms = wp_get_post_terms($post-> ID, 'columnist'); foreach($terms as $term) { $image = get_field ('image', $term-> taxonomy. '_'. $term-> term_id); $size = 'medium-square'; $attachmenturl = $image ['sizes'] [$ size]; }
The foreach does work if $terms is not empty.
So check whether the custom code added is a working code and also check for any syntax error/ typographical errors(there must not be white spaces like $ image,it should be $image).
As i already said, we can look further into your problem and correct the customised code if you could contact our support with login credentials.
Otherwise provide details of your custom-post type ,columnist,so that we can check it.the spaces are coming because I do the translation, but it follows the code that is working on my site, this is simple to make work in my frontend, see the original code.
terms = get_the_terms( $post->ID , array( 'columnist') ); foreach ($terms as $term) { $image = get_field('image', $term->taxonomy . '_' . $term->term_id); $size = 'thumbnail'; $thumb = $image['sizes'][ $size ]; if(!empty($thumb)){ echo '<img src="'.$thumb.'" alt="'.get_the_title().'">'; }
this $image is a CPT from the simple thing columnist
Does the variable $thumb returns the exact image url?
The variable $attachmenturl contains the image url,it will work if you assign the image url from your custom post type to $attachmenturl at publish.php(after line number 222) file and menu.php (after line number 77)files .
If this doesn’t work,then could you please provide a link ,from where we can download the custom post type you are using?
So that we can test this code and look further into your problem.
Thank you. -
This reply was modified 6 years, 10 months ago by
- The topic ‘Do not search the image in insert’ is closed to new replies.