PHP Classes

File: elements/category_selector.php

Recommend this page to a friend!
  Classes of Victor Andeloci   Project P Wordpress Podcast Theme   elements/category_selector.php   Download  
File: elements/category_selector.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Project P Wordpress Podcast Theme
Publish pages for a podcast in a WordPress site
Author: By
Last change:
Date: 10 months ago
Size: 552 bytes
 

Contents

Class file image Download
<?php
    $podcastCategory
= get_category_by_slug('podcast');
   
$categories = get_categories([
       
'child_of' => $podcastCategory->term_id
   
]);
    if (!empty(
$categories)) :
?>
<div class="category-selector">
        <select name="category_selector" id="category_selector">
            <option value="">Filtrar por quadro</option>
            <?php foreach ($categories as $cat) : ?>
<option value="<?= $cat->slug ?>"><?= $cat->name ?></option>
            <?php endforeach; ?>
</select>
    </div>
<?php endif; ?>