Hey Everyone, let me explain my scenario:
I have a custom category, wich have for each category a custom field called
What I’d like to do is show a different size than the original uploaded img, googling and searching I came up with:
Some values are hardcoded just to make it simple and testable
// 'custom_catalog_category' is the name of my Custom category, and 39 is id of // the category i have opened in my browser
$category_image = get_field('immagine_categoria', 'custom_catalog_category_39');
$size = "page-header";
$image = wp_get_attachment_image_src( $attachment_id, $size );
The var_dump returns bool(false).
I have followed this documentation, but I guess this only works for built-in posts types…
The wp_get_attachment_image() function will work if you actually put your values in the function. Currently, you have $image = wp_get_attachment_image_src( $attachment_id, $size ); but you need to have something like $image = wp_get_attachment_image_src( 39, 'name_of_size' );. Also, your get_field function doesn’t seem correct. I would read more into the documentation about how to use get_field.