1
1
1454802015-10-22 12:09:06
PHP
145480, 2015-10-22 12:09:06

Icon in wordpress post title?

Tell me how to make different posts have icons in the title of the post, that is, heading 1 has one icon in posts, in heading 2 there is another icon.
704a1548ca124736b0c35dca2917054c.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WP Panda, 2015-10-22
@wppanda5

Without any checks, your problem is solved stupidly in css.
A well-built output of a record in a loop looks like this

<article id="post-<?php echo $post->ID; ?>" <?php post_class(); ?>>
// содержимое записи
</article>

One of the classes returned by the post_class() function looks like this %taxonomy%-%term% , for a category with the foo slug, the class will look like this - category-foo
Insert something like this in the css
article.category-foo:before {
    width: 30px;
    height: 30px;
    content: ' ';
    background-image: url('%img-url%');
    display: block;
    position: absolute;
    top: -25px;
    left: -25px;
}

can be combined with body_class

S
Sergey Tryapkin, 2015-10-22
@Triapkin

Please check before submitting to a category. ( https://wordpress.org/support/topic/code-to-show-i...
Further through CSS.
I would like to see the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question