Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to add a custom dropdown for archives but struggling with couple of mistakes that might be the reason why it doesn’t work.

The CSS only gives my dropdown the width, not the other styles included for it. I am pretty sure the issue is about PHP. I can’t attach option values to more than just the first choice. How can I fix that?


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


.cd-dropdown > span,
.cd-dropdown ul li:nth-last-child(-n+3) span {
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);

I think the problem is about values. I am trying to style my dropdown the way Codrops teaches: here. Right now I don’t get any style at all to my dropdown, except the width that is set to 300.

share|improve this question

1 Answer 1

You're targeting cd-dropdown with a class indicator (the period), the cd-dropdown is an ID and should therefore be targeted with the ID selector (a hashtag).

#cd-dropdown > span,
#cd-dropdown ul li:nth-last-child(-n+3) span {
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.