Internetbureau Clearsite
Forum Replies Created
-
Hi Stefa98,
Ok thanks, we will take it in to consideration. First on our roadmap is some improvements on the core ideas of our plugin.
Regard,
ClearsiteHi Stefa98, do you mean you would like to use a different (extra) image size besides the default 1200 x 630 pixels?
Clearsite
Thanks for the nice review. Good to hear you love the plugin and support.
Clearsite
Yes, the Page not found issue …
I know what causes it, but I have no solution yet ??
The page fetches the title from the actual HTML, and as long as the page does not exist (never been saved), the title cannot be fetched.I guess you did not want the sneak preview ??
A toggle switch is available in the settings to switch the default to off.“After discussing with the team, we will not implement a “default disabled” set-up soon.”
Yeah, that did not age well ??
Update on your request;
While we do not intend to change the current behaviour, at least for now, you can use the following;With WordPress filter
bsi_admin_menu_location
you can move the entry to the Settings menu. Just return any value other than ‘main’, for exampleadd_filter('bsi_admin_menu_location', '__return_false');
Use filter
bsi_meta_box_context
to change the meta-box position, return eitheradvanced
,side
ornormal
, for example
add_filter('bsi_meta_box_context', 'side');
After discussing with the team, we will not implement a “default disabled” set-up soon.
We will keep it on the feature list, but we have a limited amount of time each week for further development and support for the plugin, so we must prioritise.what I can offer you at the moment is a short piece of code;
add_action('admin_footer', function() { global $wpdb; $post_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish'"); $meta_key = '_bsi_disabled'; $meta_value = 'on'; // on = BSI disabled, off = BSI enabled // query to remove ALL current values $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '$meta_key'"); // query to set BSI Enabled value for ALL POSTS foreach ($post_ids as $post_id) { $wpdb->query("INSERT INTO {$wpdb->postmeta} (post_id, meta_key, meta_value) VALUES ($post_id, '$meta_key', '$meta_value')"); } });
add this to your theme’s functions.php, or create an mu-plugin for it.
then refresh the admin-page ONCE. (it does not hurt to do more than once, it just takes time)
when the refresh is done (as in; the admin page is fully loaded), remove the code, or disable it by renamingadmin_footer
todisabled__admin_footer
or something like that.Now remember, and for anyone else stumbling upon this; this snippet will set the BSI-disabled flag for all currently published posts of all types.
When editing a post and deciding to use BSI, you can now enable BSI per post individually.
When creating a new post, you will either need to disable BSI yourself, or use it :).Not the solution you were asking for, but hopefully it gets you where you want to go.
If not, feel free to ask.a recap for future reference;
– a caching plugin interfered with displaying the debugging information
code has been added to prevent this in future.
– a CDN plugin interfered with getting the image source
code has been expanded to use a few different methods of getting the image-file-path.changes will be reflected in version 1.0.12.
If I understand correctly, you would like to be able to disable BSI unless you turn it on.
Currently, it is on unless you turn it off.That is not possible at the moment, but I will add it to the list.
the suffix ‘- My website name’ is because that is in the actual title.
You can implement a filter ‘bsi_text’ to remove it;either place this in your theme’s
functions.php
:add_filter('bsi_text', function($text) { return str_replace(' - My website name', '', $text); }, 100);
or create an mu-plugin, for example
wp-content/mu-plugins/bsi-filters.php
, with content<?php add_filter('bsi_text', function($text) { return str_replace(' - My website name', '', $text); }, 100);
You might need to create the
wp-content/mu-plugins
directory first.I can see it working for
https://www.hynerd.it/apex-legends-nuova-leggenda-nuova-arma/social-image.png/With
https://www.hynerd.it/warzone-the-haunting-2021/social-image.png/In can see the following headers:
x-og-error-fail: Generating image failed.
x-og-error-file: Source image not found. This is a 404 on the source image.Can you verify you set-up the image correctly?
If you’re feeling adventurous; can you look at lib/class.og-image.php around line 150 where it says
header('X-OG-Error-File: Source image not found. This is a 404 on the source image.');
?temporarily add var_dump($image_id, $source, $image, $width, $height, $image_file); and refresh the
https://www.hynerd.it/warzone-the-haunting-2021/social-image.png/
pageIf $image_id is not a number greater than 0, there’s a problem with image selection
$source should be an array with an URL, a width and a height, and optionally a file-type.
$image should be an URL to the image, try to access it in the browser
$with and $height should match the dimensions of the image
$image_file should be a valid file-path.Hopefully this will help you and me in the direction of a solution.
Hmmm, that is weird. In every test set-up I do with RankMath, the go:image tag is changed to url/of/the/page/social-image.png
I do see that it does not on your website.
I hope you could try out something for me;
in file
branded-social-images/lib/class.og-image-plugin.php
you will find, around line 340, the following;add_filter('rank_math/opengraph/facebook/image', [static::class, 'overrule_og_image'], PHP_INT_MAX);
can you add;
add_filter('rank_math/opengraph/facebook/og_image', [static::class, 'overrule_og_image'], PHP_INT_MAX); add_filter('rank_math/opengraph/facebook/og_image_secure_url', [static::class, 'overrule_og_image'], PHP_INT_MAX);
and see if that solves it?
sorry for the inconvenience.
Hi @stefa98, thank you for reaching out.
Branded Social Images can overrule the go:image html meta set by RankMath SEO.
If you select an image with RankMath SEO for use as Facebook image, Branded Social Images will use it.
Selection process is:
1. Image selected in BSI Meta box
2. Featured Image (if enabled in settings)
3. RankMath Facebook image
4. Fallback Image (in BSI general settings)Your second question, I don’t understand. I have checked the page and it’s generated social image (https://www.hynerd.it/apex-legends-mappa-stagione-11/social-image.png/) and I don’t see anything wrong.
Can you please tell us more?- This reply was modified 3 years, 1 month ago by Internetbureau Clearsite.
- This reply was modified 3 years, 1 month ago by Internetbureau Clearsite.
In the general settings you should find a checkbox labeled “Use the WordPress featured image”. Disabling this will remove the featured image from the consideration process. The selection process will then be
1. “Image selected at a post”
2. “Image selected with Yoast SEO” (if installed)
3. “Image selected in the general settings”.Hello @shawfactor
Thank you for your suggestions.
About 1; many plugins use a main-menu item, it is prominent, easy to find. We’ll see what we can do to accommodate your wish, but the default location will remain the main-menu for now.
About 2; moving the Branded Social Images meta-box to the side would make the image section and with that the text-edit very small, rendering it less unusable.
We have a long list of improvements, your suggestions are added to it.
Forum: Plugins
In reply to: [Contact Form 7] Private add_uploaded_fileHey @karl578,
In what hook are you trying to add the attachment?
I noticed in recent projects that it does not work in the “wpcf7_before_send_mail” hook.you could use something like this; (disclaimer: untested)
<?php add_action('wpcf7_before_send_mail', function () { // get the current CF7 submission $submission = WPCF7_Submission::get_instance(); if (!$submission || !is_a($submission, WPCF7_Submission::class)) { return; } // get the contact form for this subimssion $contact_form = $submission->get_contact_form(); // get the form properties $properties = $contact_form->get_properties(); $file_attachment_mail_tag_to_look_for = '[my_attachment]'; $attachment_needed_in_this_mail = []; // search the mail-tab properties to see in which mail the attachments needs to be sent. foreach ([ 'mail', 'mail_2'] as $property) { // todo: there are filters to add more mails, perhaps there is a way to get them all?? if (false !== strpos($properties[$property]['attachments'], $file_attachment_mail_tag_to_look_for)) { $attachment_needed_in_this_mail[] = $property; } } // which attachment? use your own logic to get the file path here ;) $attachment_file_path = this_is_the_function_that_returns_a_file_path(); // if there is an attachment, filter the mail_components if ($attachment_file_path && is_file($attachment_file_path) && $attachment_needed_in_this_mail && is_array($attachment_needed_in_this_mail)) { add_filter('wpcf7_mail_components', function ($components, $contact_form, $mail) use ($attachment_needed_in_this_mail, $attachment_file_path) { if (in_array($mail->name(), $attachment_needed_in_this_mail)) { $components['attachments'][] = $attachment_file_path; } return $components; }, 11, 3); } });