I'm a total beginner to the PHP, so sorry if my question will sound silly.
So, I am using a WordPress plugin called <a href="https://wordpress.org/plugins/automatic-featured-image-posts/" rel="nofollow noreferrer">Automatic Featured Image Posts</a>. It does a great job creating a draft post from a newly uploaded image. Apart from the plugin, I have also added this filter to the functions.php file which adds the image into the post:
So, my question is - how to add an alt image to this code? The alt image should be the same as the title of the new post. Do I have to make another function for this? I know the first thing I have to do is to add alt="" into the tag. But how do I get the title of the post to appear into the alt? Here's a link to the code of the plugin - <a href="https://justpaste.it/6pvjq" rel="nofollow noreferrer">enter link description here</a>
So, I am using a WordPress plugin called <a href="https://wordpress.org/plugins/automatic-featured-image-posts/" rel="nofollow noreferrer">Automatic Featured Image Posts</a>. It does a great job creating a draft post from a newly uploaded image. Apart from the plugin, I have also added this filter to the functions.php file which adds the image into the post:
Code:
add_filter( 'afip_new_post_content', 'myprefix_change_afip_post_content', 10, 2 );
/* Grabs the image source for the newly created image and inserts it
* into the new post content along with a one line paragraph. */
function myprefix_change_afip_post_content( $post_content, $attachment_id ) {
$my_uploaded_image = wp_get_attachment_image_src( $attachment_id );
$post_content = '<p>This is my new uploaded image....</p>';
$post_content .= '<img src="' . $my_uploaded_image[0] . '">';
return $post_content;
}
So, my question is - how to add an alt image to this code? The alt image should be the same as the title of the new post. Do I have to make another function for this? I know the first thing I have to do is to add alt="" into the tag. But how do I get the title of the post to appear into the alt? Here's a link to the code of the plugin - <a href="https://justpaste.it/6pvjq" rel="nofollow noreferrer">enter link description here</a>