0
In the article page (single.php) of my theme I have the following code that filters a div making it appear only in pages of a certain category:
<?php $categoria_post = the_category_id($categoria_post);
if ($categoria_post == 760) : ?>
<div>
...
</div>
<?php endif; ?>
I need to filter a div similarly, but from the Slug of a taxonomy (special series), ignoring the id.
Something similar, but only filtered by Slug:
EDITED
How this custom taxonomy was created:
add_action( 'init', 'create_post_tax' );
function create_post_tax() {
register_taxonomy(
'series_especiais',
'post',
array(
'label' => __( 'Séries Especiais' ),
'rewrite' => array( 'slug' => 'series_especiais','with_front' => true ),
'hierarchical' => true,
)
);
}
The problem is exactly this, taxonomy doesn’t have an id, it’s just a 2-sub-category binder. I would need to filter this taxonomy without id only by Slug.
– aarede
All taxonomies (and categories) must have an ID. My answer was based on your code, from the ID you already claim to have.
– Caio Felipe Pereira
Thanks, Caio. Did not know. Is there any way to filter only by Slug ignoring id?
– aarede
You want to capture the
slug
of the post category, is this?– Caio Felipe Pereira
The Slug I have, I don’t have the id and I need to filter through this taxonomy. I only have his Slug.
– aarede
So I don’t understand anything. I suggest you rephrase your question.
– Caio Felipe Pereira
Perhaps the second Edit with the form that this taxonomy helps understanding.
– aarede