Viewing 27 posts - 1 through 27 (of 27 total)
  • Author
    Posts
  • #1153211

    Hello. On my site I have uploaded an image, and intentionally left its ‘title’ field blank. I then created a blog post and added this image as the featured image for that post. When I view the post, the featured image displays as expected and as desired. But the title on it is not blank as expected/desired. The title is set to the title of the blog post (screenshots). Why is that occurring and how can I resolve it? I will share my login details in the private content.

    Thanks.

    #1153434

    Hey FeedXL2019,
    Thanks for the screenshots and link, this is for low vision accessibility because all browsers don’t read the alt tag of images.
    To remove the titles Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script(){
      ?>
      <script>
    jQuery(window).load(function(){
    jQuery('a').removeAttr('title');
    jQuery('img').removeAttr('title');
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Best regards,
    Mike

    #1153472

    or do not remove it but redefine it to an empty title:

    jQuery('your-selector').attr('title', ' ');
    or via property:
    jQuery('your-selector').prop('title', ' ');
    #1153474

    Hi Mike and Guenni007. Thanks for the reply and I appreciate your suggestions. But to be clear, both of those are workarounds–extra code to cover up what appears to be a bug. What about an actual solution to the issue–one that ensures the title attribute on the page is set to the value I assign it in the WordPress media library?

    For example, both of your suggestions will ensure the title attribute is blank. But what if I don’t want it blank? What if I want to set the title attribute to the value defined in the WordPress media library? With your workarounds it seems like I would have to add custom code on a per-image basis.

    Thanks.

    #1153694

    Hi,
    Sorry, from your screenshots you showed an empty title field in the media library, so I thought you just wanted to remove the post title, so I didn’t find a solution for this and I’m asking the team for advice. Thank you for your patience.

    Best regards,
    Mike

    #1153886

    Yep, my fault for not being clear on that. Thanks for passing this up to the team.

    #1154381

    Hi FeedXL2019,

    You might want to look at this file /enfold/includes/loop-index.php
    and the code here
    Image 2019-11-06 at 18.45.53.png

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1154962

    OK thanks for that. I see that the title attribute on the image is being set to $featured_img_desc. Earlier in the file, in lins 152-154, that variable is set to the post excerpt by default. Only when the post excerpt is blank will that variable be set to the image’s actual title attribute. Am I understanding that correctly?

    Those lines are:

    $desc = get_post( get_post_thumbnail_id() );
    if(is_object($desc))  $desc = $desc -> post_excerpt;
    $featured_img_desc = ( $desc != "" ) ? $desc : the_title_attribute( 'echo=0' );
    #1154997

    Hi FeedXL2019,

    Yes, this seems correct.

    Best regards,
    Victoria

    #1155198

    OK. So isn’t that a bit non-standard and undesirable? Why is the theme overriding the title attribute that I set in WordPress media library? The sole purpose of that field is to allow me to set the title attribute to anything I want.

    #1156077

    Hi FeedXL2019,

    Unfortunately, I cannot tell you why it is done like this. However, you can override this behavior.

    Best regards,
    Victoria

    #1156260

    >> Unfortunately, I cannot tell you why it is done like this.

    OK. But can you perhaps ask someone who knows the answer? Or transfer me to someone who can answer that question? Or perhaps point me to another forum in which I can ask this question (e.g. GitHub)?

    >> However, you can override this behavior.

    Yes I realize that. But on the surface, this looks like a theme bug that should be corrected in the theme code base by theme devs–wouldn’t you agree?

    #1157115

    Hi,

    Thank you for the update.

    We are not really sure about the actual logic behind it, but the first thing that comes to mind is to keep the title attribute filled, so it’s not empty. You can always override the template in the child theme if you don’t really need to add a description for the featured featured image using the the title attribute. It can be considered as a bug or an error if the title or the description field is not working.

    Best regards,
    Ismael

    #1157123

    >> We are not really sure about the actual logic behind it,

    Then who is? Can I speak with that person? Or can you pass along my questions to that person? I asked you these questions in my previous message, but you ignored them :-( This ticket is nearly two weeks old now, and there still hasn’t been much movement. If I could speak with someone who is actually familiar with the code and the logic behind it, it would speed things up.

    #1157749

    Hi,

    Then who is? Can I speak with that person?

    Kriesi is quite busy right now, so he might not be able to answer this thread immediately. We will tag one of our developers to check the thread, but he will probably tell you the same — that the purpose of the current code is to keep the title attribute filled — it’s arbitrary. Again, you can always override the template in the child theme if you want to keep the title attribute empty. Let us know if you require assistance with it.

    Best regards,
    Ismael

    #1157802

    >> We will tag one of our developers to check the thread

    Please do so. I would like to speak with a developer as soon as I can. It has been 16 days now, and there has been zero movement on this issue :-(

    Thanks.

    #1157852

    Hey!

    Sure thing. He might not respond immediately, so you might wait for a while. Again, if all you want to do is remove the title, you can always edit the includes > loop-index.php template as previously suggested. Look for this code around line 154:

    $featured_img_desc = ( $desc != "" ) ? $desc : the_title_attribute( 'echo=0' );
    

    Replace it with:

    $featured_img_desc = ( $desc != "" ) ? $desc : '';
    

    This modification will keep the $featured_img_desc variable empty when the description field is empty.

    Regards,
    Ismael

    #1158047

    >> He might not respond immediately, so you might wait for a while.

    OK. Can you give me an estimate? Are you talking about weeks, months, years? I paid for support, and just want some questions answered.

    >> Again, if all you want to do is remove the title,

    If you read what I’ve already written in this post, I’ve explained that removing the title is not all I want to do.

    #1158765

    Hi,

    Thank you for the update.

    If we read the post correctly, you wanted to use the value of the title field instead of the image caption or description as the value of the featured image’s title attribute. Please edit this line in the same file..

    if(is_object($desc))  $desc = $desc -> post_excerpt;
    		$featured_img_desc = ( $desc != "" ) ? $desc : the_title_attribute( 'echo=0' );
    

    .. and replace it with:

    if(is_object($desc))  $desc = $desc -> post_title;
    		$featured_img_desc = ( $desc != "" ) ? $desc : '';
    

    Best regards,
    Ismael

    #1160563

    Well you’re still not exactly understanding what I want. I don’t want to insert the post title–I want to insert the ‘title’ attribute for the image in-question. But no worries–I have enough so that I can move forward with a solution on my own. Thanks for the help. I have one last question though. I am going to copy the file /includes/loop-index.php to my child theme, and make edits to it. Just so I know, other than individual blog posts, what other pages execute this file (loop-index.php)?

    Thanks.

    #1160853

    Hi,

    I don’t want to insert the post title–I want to insert the ‘title’ attribute

    We do understand you’re inquiry. The post_title in that modification refers to the title attribute of the featured image, not the title of the actual post.

    what other pages execute this file (loop-index.php)?

    It’s also used in the archive.php template.

    Best regards,
    Ismael

    #1160872

    >> We do understand you’re inquiry. The post_title in that modification refers to the title attribute of the featured image, not the title of the actual post.

    OK my mistake–I was a bit hasty. You are correct.

    >> It’s also used in the archive.php template.

    OK thanks. So any page that has ‘Archives’ as the value for ‘Template’ (example) would execute loop-index.php. Am I understanding that correctly?

    #1160875

    Hi,

    Thank you for the update.

    The custom Archive template doesn’t use the loop-index.php file, only the default archives template like archives.php, tag.php files, index.php and the default blog element or config-templatebuilder > aviashortcodes > blog.php file. Try to look for this line:

    get_template_part( 'includes/loop', 'index' );
    

    Best regards,
    Ismael

    #1160898

    OK let me ask my question in a different way. Let’s say I have 50 pages on my site. How can I determine which of them execute loop-index.php?

    #1161172

    Hi,

    Those pages containing a Blog Posts element — assuming that they are built using the ALB and that the blog layout is set accordingly — will execute the loop-index.php file.

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

    #1161176

    OK thanks. We can consider this resolved.

    #1161198

    Hi,
    Glad Ismael could help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 27 posts - 1 through 27 (of 27 total)
  • The topic ‘Featured image 'title' is not as expected.’ is closed to new replies.