Support » Fixing WordPress » WP 2.0 and my-hacks.php (archive menu dropdown)

Viewing 11 replies - 1 through 11 (of 11 total)
  • You can enable my-hacks.php under Options > Miscellaneous, but I recommend that you either put into a plugin the function mentioned at , or even easier, include it in a file named functions.php and put it in your theme’s folder (along with index.php, sidebar.php, header.php, etc).

    I’ve got a similar feature at my blog. Try adding the following code to where you want the dropdown menu to appear (if you don’t mind using Javascript):

    <form name="archiveform" action="">
    <select name="archive_chrono" onchange="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">
    <option value=''>Select Month:</option>
    <?php wp_get_archives('format=option'); ?>

    Thanks for the tips!

    I have never created a plugin on my own.

    Is it as simple as…

    1. Creating a file called functions.php

    2. Copy and paste the code from into functions.php

    3. Go to “plugins” in the WP interface select it, activate it, and off I go?

    Thanks for this!

    Harvey, here’s what you need to do–you don’t have to create a plugin. Copy all the code at (from function make_month_dropdown() {
    echo '</div></form>';

    and paste it into a file named functions.php, which you’ll put in your theme’s folder. Note: you’ve also got to put <?php at the very beginning of the file and ?> at the end.

    Then, as it says on that page, look in your theme’s files for something like
    <?php get_archives(); ?>
    and replace it with
    <?php make_month_dropdown(); ?>
    In the WordPress “Classic” theme, <?php get_archives(); ?> is found in the file sidebar.php.

    Thanks for that!

    In the POOL theme, sidebar.php using a function call like this…

    <?php wp_get_archives('type=monthly&show_post_count=1'); ?>

    Instead of <?php get_archives(); ?>

    I believe it is the same though, and replaced that line with
    <?php make_month_dropdown(); ?>

    As you suggested.

    I also created function.php with the code on the site, plus the opening and closign PHP tags.

    However, when I upload both to the themes directory, I get an error from sidebar.php.

    Fatal error: Call to undefined function: make_month_dropdown() in /usr/www/users/jnewbie/blog/wp-content/themes/pool/sidebar.php on line 50

    Seems that even though function.php is up there, the function isn’t being found?

    It needs to be functions.php with the “s,” not function.php.

    Worked like a charm. Thanks filosofo, I really appreciate it!

    filosofo, i’ve tried the same thing, trying your suggestions, and I get the following error:

    Parse error: syntax error, unexpected T_VARIABLE, expecting ‘,’ or ‘;’ in /home/.honor/obscure/ on line 20

    could this be something specific to the WP 2.0 theme i’m using?

    I created the functions.php file in the root folder of my theme and inserted the PHP codr in there. any ideas?

    According to DreamWeaver, line 20 is:
    echo “<option value=”$thisM””;

    I’d appreciate any information you might have.


    Nick –

    I think that line has a few too many double-quotes in it. Try either:
    echo "<option value=$thisM";
    echo '<option value='.$thisM;

    thanks a million rdsmes,

    that’s what it was!

    (i’m more of a coldfusion programmer, not a php kinda guy, so thanks again)


    Does anybody know how to do the same with categories, recent posts and commets?

    Tank you.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘WP 2.0 and my-hacks.php (archive menu dropdown)’ is closed to new replies.