• So, I try to make it fast and clear. I found a good dropdown tutorial. https://tympanus.net/codrops/2012/11/29/simple-effects-for-drop-down-lists

    Now I am trying to integrate it with my theme so that archives dropdown has exactly the same style. I am writing because I can′t find a mistake myself.

    What I have already?

    <select name="archive-dropdown" id="cd-dropdown" class="cd-select"onchange="document.location.href=this.options[this.selectedIndex].value;">
      <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option>
      <?php wp_get_archives( array( 'type' => 'monthly', 'format' => 'option', 'show_post_count' => 1 ) ); ?>
    </select>

    I copy-pasted all the css to my style.css and wp-enqueued javascript on functions.php.

    What is the problem?

    Option values.

    In Codrops the html has select options with values.

    <select id="cd-dropdown" class="cd-select">
        <option value="-1" selected>Choose an animal</option>
        <option value="1" class="icon-monkey">Monkey</option>
        <option value="2" class="icon-bear">Bear</option>
        <option value="3" class="icon-squirrel">Squirrel</option>
        <option value="4" class="icon-elephant">Elephant</option>
    </select>

    But how could I add values to my wp_archive dropdown? It has just a single option and it should be -1.

    Someone here knows how to do it? Thank you.

  • The topic ‘Codedrops custom dropdown integration with archive dropdown’ is closed to new replies.