0

I have a question. Right now I displayed my posts in the next way: Title and under it a short description of that post(everything centered and the post is looking like a card). My client wants each post to have a background color and a text color, but set by him, something like on this site: https://the.loeuvre.co/. Do you have any ideas of how can I make this? Yes, I can give a random class to each post and created those classes with background and color but I don't know if it will appear something new and it will be too many classes with a lot of combinations. Thank you!

2 Answers 2

0

If the site uses the Block Editor, support is already built in. Add a Group block first, and set its background color. You can then add blocks inside the Group block and set their text colors.

You can define a specific palette for your theme so there are set colors, or you can let WordPress set default color palettes. It also supports custom colors so you can use a color picker to define whatever combinations you want.

It would be wise to educate the client on accessibility as it relates to color contrast. It may also be helpful to educate the client on the ways having defined, predictable color and UI schemes is helpful to visitors who navigate through multiple pages on the site - changing colors frequently may create a jarring or difficult-to-read experience.

0

Thank you for your response but I forgot to add the code:

<div class="latest-posts">
    <?php
        $args = array(
            'post_type' => 'post',
            'posts_per_page' => 5,
            'orderby' => 'date',
            'order' => 'DESC',
            'post_status' => 'publish',
            'paged' => 1,
        );
        $my_posts = get_posts($args);
        if(!empty($my_posts)){
            foreach($my_posts as $post){ ?>
                <div class="article">
                    <div class="article-text">
                        <div class="title">
                            <?php echo get_the_title($post); ?>
                        </div>
                        <div class="short-article-content">
                            <?php echo the_excerpt(); ?>
                        </div>
                    </div>
                </div>
            <?php }
        }
    ?>
   
</div>
<button class="load-more-homepage-articles-btn btn">Load more articles</button>

This is my code in articles.php(template that I use it on article page). I want to add that background color and color to the article class. Yes, The site will use Block Editor. It's not a problem about colors. He know about how to use/choose hex and rgba

1
  • Please edit your question to provide this information rather than post as an answer. Click the edit link directly below the question text.
    – Bysander
    Mar 28 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.