Support » Themes and Templates » Category dropdown that links to first post in category

  • I’m working on a comic book reader for a client’s web comic.
    I’m only just getting in to WordPress, so this has really stumbled me.

    I am dividing the chapters of the comic using categories.
    At the head of the website I want a select box that displays all the chapters (categories) and will bring them to the first post in each chapter (category) on click.
    I’ve pretty much got it, I just don’t know how to direct them to the permalink of the first post in the category.

    <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 
            $categories=  get_categories('child_of=3');
            foreach ($categories as $category) {
                $option = '<option value="/pdcomic/chapter/'.$category->category_nicename.'">';
                $option .= $category->cat_name;
                $option .= '</option>';
                echo $option;
  • The topic ‘Category dropdown that links to first post in category’ is closed to new replies.