Support » Fixing WordPress » Navigation Help

  • I need a way to make a navigation button that sends a reader to a categories first post depending on which category they’re currently looking at. Pleeeeease help!

Viewing 1 replies (of 1 total)
  • This seems to work for me:

    Create a template that displays a single post in a category which is passed in the GET variable ‘mycat’. Code similar to this:

    $cat = $_GET['mycat'];
    if (have_posts()) {
       while (have_posts()) {
    } else {
       // Code here for nothing found

    Assuming that you want the button on a category page, create it like this:

    <?php $cat = get_query_var('cat');
     $action = get_bloginfo('url') . "/my-single-cat-page-slug/";
    <form action="<?php echo $action; ?>" method="get">
       <input type="hidden" name="mycat" value="<?php echo $cat; ?>">
       <input type="submit" value="Run me now!">
Viewing 1 replies (of 1 total)
  • The topic ‘Navigation Help’ is closed to new replies.