WordPress.org

Ready to get started?Download WordPress

Forums

archives dropdown menu (30 posts)

  1. danithew
    Member
    Posted 10 years ago #

    What kind of code do I need to enter into index.php to get a dropdown archives menu instead of a list? I've been looking around and seen a few possibilities. 2fargon raised a question some time ago about some index.php code that would also involve javascript.

  2. carthik
    Member
    Posted 10 years ago #

    This is the code that I use on my site:
    <li id="archives">Archives:
    <ul>
    <li><a href=""<?php">/narchives.php">Categorized, sortable archives</a></li>
    <li><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=''>By Month</option>
    <?php get_archives('','','option', 1); ?>
    </select>
    </form></li>
    </ul>
    </li>

    See the output on my blog, and change it as desired.

  3. bAs
    Member
    Posted 10 years ago #

    You rock 2fargone!!!!

  4. pvicnan
    Member
    Posted 10 years ago #

    Hmm.. Is it possible to adapt this for the Categories? I used the following, but the result was.. >.<

    • <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</option>
      <?php get_cats('','','option', 1); ?>
      </select>
      </form>

  5. Mark (podz)
    Support Maven
    Posted 10 years ago #

    This works for categories:
    <li id="categories"><?php _e('Categories:'); ?>
    <form action="<?php echo $PHP_SELF ?>" method="get">
    <?php dropdown_cats(); ?>
    <input type="submit" name="submit" value="view" />
    </form>

  • Geoffrey Sneddon
    Member
    Posted 9 years ago #

    I have the whole window.location = value but It's not being displayed here...

  • Geoffrey Sneddon
    Member
    Posted 9 years ago #

    Anyone for my problem? Anyone?

  • mindlessLemming
    Member
    Posted 9 years ago #

    Link: Add a submit button and point the form to a php page which grabs the value and redirects to that url.

  • Geoffrey Sneddon
    Member
    Posted 9 years ago #

    Thanks mindlessLemming... That's just one of those times when you say to yourself: "Why on earth did I not think of that?" Anyhow, thanks.

  • AkaMaDdiSk
    Member
    Posted 9 years ago #

    Does anyon know how I can style this new archive dropdown menu?
    Help is much appreciated.
    Thanks.

  • aadhu
    Member
    Posted 9 years ago #

    <form name="archiveform" action="" Style="background-color:#F8F9FD; border: solid #F8F9FD 1px;">
    u can use the Style command to style :P

  • aeryn
    Member
    Posted 9 years ago #

    I'm using this script by 2fargon for my archives dropdown menu. The only problem I came up with is that there's this annoying "1" in front of each month in the drop menu. How do I remove that? Thanks.

  • aeryn
    Member
    Posted 9 years ago #

    I have solved this issue at last. I simply removed "1" within php tag and it simply vanished. In case anyone wants to know.

  • mattybinks
    Member
    Posted 9 years ago #

    carthik, can you please post your source in this thread so that it is readable? your initial post looks like this:

    <li id="archives">Archives:

    /narchives.php">Categorized, sortable archives
    <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=''>By Month</option>
    <?php get_archives('','','option', 1); ?>
    </select>
    </form>

  • jaron
    Member
    Posted 8 years ago #

    aeryn or whoever...
    Have same problem that you fixed (the number 1 placed infront of month).
    Everything else works great. Need to know more about how to remove the "1". My code is...

    • <h2>Archives</h2>

    <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=''>Monthly Records</option>
    <?php get_archives('','','option', 1); ?>
    </select>
    </form>

    Cheers Jaron

  • jaron
    Member
    Posted 8 years ago #

    thanks macmanx... works like a charm.

  • archshrk
    Member
    Posted 8 years ago #

    How can I modify that so it fits my theme better?

  • -joe
    Member
    Posted 8 years ago #

    How can I "toggle" between the Theme Manji and LetterHead?
    Right now I can go from LetterHead to Manji, Rin, Classic
    but I can't go back using theme-switcher. Thanks

  • lightspeed
    Member
    Posted 8 years ago #

    Hello. I am looking for the above, code to create a drop-down menu for categories and archives. In a previous MT-installation, I was able to do create this without any weeping or gnashing of teeth.

    In the above replies, Carthik posted a few lines of code to create a drop-down menu for archives, and was followed by podz, who posted a few lines of code to create a drop-down menu for categories.

    My problem is that I am not a coder or programmer or hacker - I don't know php. I know how to edit the WP files, etc., but I do not know where I am to paste the above code so that my archives (and then categories) will appear in drop-down menus as opposed to ever-increasing lists.

    My request is, would someone kindly explain to me what I am to do and where I am to post the above code? Also, the same for the above category code.

    Thanks kindly, anyone and everyone.
    - Randy

  • lassemahn
    Member
    Posted 8 years ago #

    To remove the "1" just replace 1 with '' in the code.. ie:

    <h2>Archives</h2>

    <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=''>Monthly Records</option>
    <?php get_archives('','','option', ''); ?>
    </select>
    </form>

  • mechietechie
    Member
    Posted 8 years ago #

    I was able to succesfully get the categories drop down working with out problem. But, I have many subcategories, and when they were all listed, each subcategory would be aligned a little towards the right under its parent. How can i do this in the drop down menu. You can see both at http://www.mechietechie.com

  • spencerp
    Member
    Posted 8 years ago #

    EDIT* Shoot, you wanted the archive's one, well..I'm not fully awake yet. I'll post it in as a new reply lmao.. <slaps self> wake up spencerp, wake up gerd damn it!!

    Here's one that it's my dev theme, I'm not sure if I'm going to keep it or not though..

    Don't mind the <tr> <td>'s and stuff..

    <tr>
    <td align="left" width="117">
    <select name='cat' class='postform'>
    <option value='0'>By Categories</option>
    <option value="1">Uncategorized</option>

    <option value="2">General</option>

    </select>
    </td>

    <td align="left" width="25"><input type="image" src="http://localhost/boxed/wp-content/themes/AO8r/img/go.jpg" border="0" id="searchsubmit" value="Search" /></td>
    </tr>

    The value "1" and such are the "catagory ids" from the Catagory manager in control panel.. This seems to be working just fine for me for testing.. I hope this help maybe..

    spencerp

    value='0' isn't one for choosing, so it just displays:By Categories when page is refreshed and loaded and such..

  • spencerp
    Member
    Posted 8 years ago #

    Here it is, and I think it's like the ones above though. But anyways, just thought I'd post it though.. =P

    <form name="archiveform" id="archiveform" action="">
    <table cellspacing="2" cellpadding="0" border="0" width="142">
    <tr>
    <td align="left" width="117"><select style="width: 117px;" name="archive_chrono" onchange="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">
    <option value=''>By Month</option>
    <option value='http://localhost/boxed/?m=200605'> May 2006 </option>
    <option value='http://localhost/boxed/?m=200604'> April 2006 </option>

    <option value='http://localhost/boxed/?m=200603'> March 2006 </option>
    <option value='http://localhost/boxed/?m=200602'> February 2006 </option>
    <option value='http://localhost/boxed/?m=200601'> January 2006 </option>
    </select>
    </td>
    <td align="left" width="25"><input type="image" src="http://localhost/boxed/wp-content/themes/AO8r/img/go.jpg" border="0" id="searchsubmit" value="Search" /></td>
    </tr>

    </table>
    </form>

    I hope this helps, but like I said, I think this was already basically posted above..dang..wake up spencerp, wake up!!

    Here's some screen shots.. The first is both of the "selectors" closed, second one is the Archive "selector open".

    http://www.vindictivebastard.net/images2/selectors-closed.gif

    http://www.vindictivebastard.net/images2/selector-open.gif

    spencerp

    That works, and really I don't think you'd need a "Go" button, because when I choose a month, it automatically takes me to the page with that content for that month in it already.. without clicking the button..but who knows..

  • eidderf
    Member
    Posted 8 years ago #

    I'd like to make a similar dropdown menu for wp_list_authors. Can anyone please help me on this? Thanks

  • eidderf
    Member
    Posted 8 years ago #

    Can anyone point me into the right direction on how to create a dropdown menu for authors? Any help will be much appreciated. Thanks :)

  • aaron1728
    Member
    Posted 8 years ago #

    Is there an implementation that doesn't require the VIEW button but simply jumps to the correct page selected in the dropdown menu?

  • annliu
    Member
    Posted 7 years ago #

    Hi Guys,

    Thanks for all the great information. After searching for long time, finally this dropdown archives menu thread help me solve the problem :-)

    I especially want to thanks Spencerp, he always give his time and help others -- Thank You Spencerp!

    Cheers
    Ann

  • spencerp
    Member
    Posted 7 years ago #

    Awww, thanks for your kind words Ann. =) It was no trouble at all.. ;) I knew I had that thread in my past history there some where lol! Glad it worked for you! =)

    spencerp

  • maryjors
    Member
    Posted 7 years ago #

    Aaron asked... "Is there an implementation that doesn't require the VIEW button but simply jumps to the correct page selected in the dropdown menu?" I'm interested in the same thing. Can anyone help?

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags