WordPress.org

Ready to get started?Download WordPress

Forums

Codedrops custom dropdown integration with archive dropdown (1 post)

  1. meigo_wordpress
    Member
    Posted 1 year ago #

    So, I try to make it fast and clear. I found a good dropdown tutorial. http://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.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by meigo_wordpress
  • This topic is not resolved
  • WordPress version: 3.5.1