Answer the question
In order to leave comments, you need to log in
Set entry class with id?
There are received id records in the form 22 , 37 ,12 all separated by commas,
how can I set the class with this id ? or through style
I try like this
<?php $custom_values = get_post_meta($post->ID, 'продукт_в_отраслях'); ?>
<li id="post-<?php the_ID(); ?>" <?php post_class( $custom_values ,$custom_values ); ?>>
Answer the question
In order to leave comments, you need to log in
Hello!
If I understand your example correctly, then you are using the ACF plugin.
A simple example of how you can set a class, provided that the article being viewed matches the post id.
<?php if(is_single(array(22,37,12))) { ?>
<!-- ваш код здесь -->
<?php } ?>
<?php if(is_single(array(22,37,12))) { ?>
<div class="content"> <!-- открыв тег -->
<?php } ?>
<!-- bla bla content -->
<?php if(is_single(array(22,37,12))) { ?>
</div> <!-- закрыв. тег -->
<?php } ?>
but since id's are separated by commas it doesn't work
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question