• Resolved Siouxsie

    (@siouxsie)


    Hi,
    I have been working on a rather simple download pulldown menu that gets it’s data via the wpdb.

    I have gotten pretty far but I think I have some errors because I get nothing returned.

    Here is the code:

    <?php
    global $wpdb;
    $today = "CURDATE()";
    $daterange = "DATE_SUB($today, INTERVAL 1 MONTH)";
    $row_getbulletin = $wpdb->get_row("SELECT title, filename FROM wp_download_monitor_files WHERE postDate > $daterange ORDER BY postDate DESC", ARRAY_A);
    echo  '<form id="page-changer" action="" method="post">
        <select name="archive">
          <option value="">read the bulletin</option>';
    foreach ($list_bulletins as $row_getbulletin)
         {
    		echo  '<option value="$list_bulletins->filename">$list_bulletins->title</option>';
    }
    echo  '</select>
    	<input type="submit" value="Go" id="submit" />
    </form>';
    $show_errors;
    //$wpdb->flush(); 
    
    ?> <p></p>

    Any help would be appreciated
    thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter Siouxsie

    (@siouxsie)

    well I figured it out – I was trying to reinvent the wheel – I ended up using the shortcode from the wp download manger plug-in. DAH!

    here’s the code if your interested ->

    <?php
    $dl = get_downloads('limit=5&orderby=date&order=desc');
    
    if (!empty($dl)) {
        echo '<form id="page-changer" action="" method="post">
        <select name="archive">
          <option value="">read the bulletin</option>';
        foreach($dl as $d) {
            $date = date("jS M Y", strtotime($d->date));
            echo '<option value="'.$d->url.'">'.$d->title.'</option>';
        }
        echo '</select>
    	<input type="submit" value="Go" id="submit" />
    </form>';
    }?>
Viewing 1 replies (of 1 total)
  • The topic ‘adding a widget using php code plugin’ is closed to new replies.