WordPress FSE image category
-
Hello,
I’m trying to update an old theme to wordpress 5.9 (with FSE).
In this theme I replaced the meta category with an image with the following code:
<div class="post-categories"> <?php // Display categories icons $icoCategories = array("castors", "loups", "scouts", "unite", "pionniers", "photos", "intro-posts"); foreach((get_the_category()) as $category) { $catName = $category->slug; if(in_array($catName, $icoCategories)) { $category_link = get_category_link( $category->cat_ID ); echo '<a href="'.esc_url( $category_link ).'" target="_self" class="ico-'.strtolower($category->slug).'"> </a>'; } } ?> </div>
Could someone explain to me how to modify the following block to have the same result (if then else) ?
<!– wp:post-terms {“term”:”category”} /–>
Since the FSE sites are in HTML I assume that I have to go through JSX, right ?
Thank you in advance
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPress FSE image category’ is closed to new replies.