Customize specific part on post in title on front page – WordPress news site

Please help me solve my problem. I want to make this as in the picture, more precisely I want to highlight one part of the title on the home page and in the post when you open it. Is there a plugin on wordpress or something similar? The theme of my site is NEWSPAPER. I tried everything but it didn’t work

https://preview.redd.it/sgw52pj3qph91.png?width=1018&format=png&auto=webp&s=12a811967dc878372a66fe87ed98d967dcd3400c

https://preview.redd.it/ychi4tj3qph91.png?width=1276&format=png&auto=webp&s=b428622d838784bb57c4b09309ea7ce667d45e6c

2 Comments
  1. If it’s a mouse hover effect or any other visual modification, you would need to know basics of CSS in order to do it.

  2. This can be done, but probably not easily.

    You might be able to use jquery:

    $(“#firstWord”).html(function(){
    var text= $(this).text().trim().split(” “);
    var first = text.shift();
    return (text.length > 0 ? “<span class=’red’>”+ first + “</span> ” : first) + text.join(” “);
    });

    and modify it to loop through your class selector (e.g. h2.post-title )

    For a function – I think you’ll have to use the pre_get_posts filter – and extract the first word, wrap it in a span with a class, and re-inject it into the title. Or do it directly by outputting in-line css.

    Otherwise, you could create a child theme, and edit the archive.php file and add the span-injection there.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here