Karl-G?ran Gustavson
Forum Replies Created
-
I can’t seem to find where the character count is in the plugin or do you mean how much text is in post_content from all the blocks?
Characters?2753?Words?367?Lines?40
I’ve got screenshots on all views of the plugin on the page I’ve tested this time on. But I can’t seem to include them here without self-hosting the screenshots.No it’s a Gutenberg block made with ACF. So all it’s content is saved in post_content.
So I’ve been checking out the issue #275 and it seems it’s part of 1.5.6 and the plugin is now 1.6.0 (I’ve updated). But it still sais: Post Reading Grade Level: None. Your post does not contain enough content to calculate its reading level.
I’m also wondering if it’s reading our content properly at all. As I said in the initial post. We’re using ACF to generate our blocks and has a very different type of admin when it comes to Gutenberg but essentially we’re using Gutenberg (minus the preview functionality). I can expand on this if needed. But I get the feeling it doesn’t check content at all (for us).
I’ll show you more of the code, hopefully it’ll make more sense. Also, the return_format should be an array not url. I’m refering to the image crop Field. I’ve pasted the field code here, you can select it to return an array when you set the field up in ACF.
array( 'key' => 'field_6061d07fb0fb8', 'label' => 'Bild', 'name' => 'image', 'type' => 'image_aspect_ratio_crop', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array( 'width' => '', 'class' => '', 'id' => '', ), 'crop_type' => 'aspect_ratio', 'aspect_ratio_width' => 50, 'aspect_ratio_height' => 37, 'return_format' => 'array', 'preview_size' => 'medium', 'library' => 'all', 'min_width' => '', 'min_height' => '', 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => '', ),
$image = get_field('image'); $img_alt = ''; if ( isset($image['image']['alt']) && $image['image']['alt'] ) $img_alt = $image['image']['alt']; else if ( isset($image['image']['original_image']) && isset($image['image']['original_image']['alt']) && $image['image']['original_image']['alt'] ) $img_alt = $image['image']['original_image']['alt']; echo '<img loading="lazy" src="'.$image0x.'" data-src="'.$image_d1x.'" data-srcset-d="'.$image_d1x.' 1x, '.$image_d2x.' 2x" data-srcset-m="'.$image_m1x.' 1x, '.$image_m2x.' 2x" class="lazy" alt="'.$img_alt.'" />';
This is how I use it. If the cropped image has an alt-text it’ll use that. If not, it’ll fall back to the original image.
One way for you to debug is to use print_r on the $image or var_dump($image); then use die();
You can access the original image details in the image array. Something like this.
if ( isset($image['image']['original_image']) && isset($image['image']['original_image']['alt']) && $image['image']['original_image']['alt'] ) $img_alt = $image['image']['original_image']['alt'];