• Hello,

    I need to change the post title color to green on the main page, The post titles to be changed are chosen when posting the new post.
    Can this be done in WordPress?

    Scenario: I’m Posting a new “important” post, before publish i need to change the title color to green and then publish so it shows in green color title on the wordpress site.

    Thanks for your guidance

    • This topic was modified 4 years, 8 months ago by Jan Dembowski.
Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter jameshallow1

    (@jameshallow1)

    I can see that the title shows under <div class="read-title"> so i need to add the css code to make the text color “green”.

    For my site it is:

    .post-2503 h1.entry-title {color:green;}

    You need to find out the number of the post, which is before the <div> you’ve mentioned.

    Thread Starter jameshallow1

    (@jameshallow1)

    It does not have that. its simply this:

    <div class="read-title">
    <h4>
    <a href="https://localhost/wordpress/2020/08/03/testpost">
    Test Post
    </a>
    </h4>
    </div>

    Hi jameshallow1
    Could you please give me an screenshot from your page.
    On the post title right-click>inspect and send me the screen of the code you get.

    • This reply was modified 4 years, 8 months ago by Linards.
    Thread Starter jameshallow1

    (@jameshallow1)

    Hi Linards,

    Here you go the screenshot you asked for:
    https://ibb.co/YtDV29c

    Try this if it works.

    .read-title a {
        color: #008000;
    }

    Maybe this will change ALL post-titles into green, not only on the Main-page

    Thread Starter jameshallow1

    (@jameshallow1)

    Yeah it would change everything..
    I had an idea which would solve this issue:

    Is it possible to change the color of all post titles of a specific category?
    .category-testing .post-title { color:green !important; }

    I took the idea from this question: https://stackoverflow.com/questions/20453796/change-color-title-if-category-is

    though it did not work for some reason.
    any idea?

    Can’t you find a post-number? Maybe it’s ABOVE the codes you’ve sent by your screenshot https://ibb.co/YtDV29c.
    Then you could use someting like:
    .post-2503 .post-title {color:green;}

    • This reply was modified 4 years, 8 months ago by willem0.
    Thread Starter jameshallow1

    (@jameshallow1)

    It does not exist I’m sure, I tried searching as well for post- using the Inspect Element and there was no post ID.
    I’m looking through the source code of the home page that shows the different posts.

    Try this:
    Dashboard > Pages > Mainpage (select) > Click “Edit”.
    Now you’ll find in the address-bar of your browser an URL like:
    https://www.yourwebsite.com/wp-admin/post.php?post=994&action=edit
    In this example: 994 is the postnumber of the page.
    When you’ve found this ID, try:

    .post-994 h1.entry-title {color:green;}

    Thread Starter jameshallow1

    (@jameshallow1)

    yes got it! this would help me color a specific post title to red while im looking to color several posts depending on some specific criteria.
    I was able to do that thanks to the plugin Advanced Custom Fields… It can be used to add an option field on the new post page.
    What remains is to find out in which file the titles are being retrieved so i can wrap them with my php code.

    If you have any idea that would be awesome! i tried in functions.php but failed to find it.

    No. I’m sorry. I can’t look into your theme-files.

    Thread Starter jameshallow1

    (@jameshallow1)

    Well actually thanks a lot! you pointed me in the right direction.
    I really appreciate your help!!

    Error in my last answer. Should be:

    .post-994 .read-title {color:green;}

    • This reply was modified 4 years, 8 months ago by willem0.
Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Changing Post Title Color on main page’ is closed to new replies.