- I created a custom field in a post, called "post-class" and inserted the value "cita-flow800000".
- Called the new custom_value in my content-single.php in front of the post_class function, and inserted the variable inside the post_class function, like this:
<article id="post-<?php the_ID(); ?>" <?php post_class('class-1 class-2' . $custom_variable); ?>> <?php $custom_values = get_post_meta($post->ID, 'post_class'); ?>
- Selected the class in my style.css:
.cita-flow800000 { background-color: red; }
...and nothing happens. Can anyone help me spot where I missed the mechanism to achieve post stylling through different post classes?
I followed this recipe in this blog post
I tried changing the variable inside the post_class function into "$custom_values", thinking that "$custom_variable" could be a typo from the post that shared the recipe.
Aucun commentaire:
Enregistrer un commentaire