• Hi,
    I’m trying to modify the archive.php file because I need to order the results from the query in a datetime way…

    The Loop start with the typical:

    <?php
    while ( $the_query->have_posts() ) : $the_query->the_post();
    ?>

    So I read around and people in previous posts suggested to use this before:

    <?php query_posts('meta_key=data&orderby=meta_key&order=DESC');?>

    But doesn’t work.

    The table fields where he’s grabbing data with mysql is something like this:

    INSERT INTOwp_postmeta(meta_id,post_id,meta_key,meta_value`) VALUES
    (86074, 15099, ‘orario_corsi’, ‘15.00 – 18.00’),
    (86075, 15099, ‘tipo_corso’, ‘Demo gratuita’),
    (86076, 15099, ‘punti_vendita’, ‘a:1:{i:0;s:8:”Collegno”;}’),
    (86077, 15099, ‘data’, ‘20130930’),
    (86078, 15099, ‘prezzo_corso’, ”),
    (86079, 15099, ‘_wp_page_template’, ‘default’),
    (86080, 15099, ‘_yoast_wpseo_linkdex’, ’43’),
    (86081, 15099, ‘_edit_lock’, ‘1378307873:1’),
    (86082, 15099, ‘_thumbnail_id’, ‘14271’),
    (86083, 15099, ‘_edit_last’, ‘1’),
    (86084, 15099, ‘novità’, ‘0’),
    (86085, 15099, ‘_novità’, ‘field_51a49e93b7613’),
    (86086, 15099, ‘_punti_vendita’, ‘field_51891cfde30f4’),
    (86087, 15099, ‘_data’, ‘field_518cbb149ef68’),
    (86088, 15099, ‘_orario_corsi’, ‘field_521f68b550fbd’),
    (86089, 15099, ‘_prezzo_corso’, ‘field_521f6a53c2ec6’),
    (86090, 15099, ‘_tipo_corso’, ‘field_521f68fbb78a5’),
    (86091, 15099, ‘gallery’, ‘0’),
    (86092, 15099, ‘_gallery’, ‘field_517b9480b9e6d’),
    (86093, 15099, ‘documenti’, ‘0’),
    (86094, 15099, ‘_documenti’, ‘field_517b94ece23db’),
    (86095, 15099, ‘_expiration-date’, ‘1380578400’),
    (86096, 15099, ‘_expiration-date-options’, ‘a:2:{s:10:”expireType”;s:5:”draft”;s:2:”id”;i:15099;}’),
    (86097, 15099, ‘_expiration-date-status’, ‘saved’),
    (86098, 15099, ‘_yoast_wpseo_focuskw’, ‘medium materici’),
    (86099, 15099, ‘_yoast_wpseo_title’, ‘Rilievi d”effetto – Viridea’),
    (86100, 15099, ‘_yoast_wpseo_metadesc’, ‘Usiamo i medium materici per effetti tridimensionali.’),
    (86101, 15099, ‘_yoast_wpseo_meta-robots-noindex’, ‘0’),
    (86102, 15099, ‘_yoast_wpseo_meta-robots-nofollow’, ‘0’),
    (86103, 15099, ‘_yoast_wpseo_meta-robots-adv’, ‘none’),
    (86104, 15099, ‘_yoast_wpseo_sitemap-include’, ‘-‘),
    (86105, 15099, ‘_yoast_wpseo_sitemap-prio’, ‘-‘),
    (86106, 15099, ‘_yoast_wpseo_sitemap-html-include’, ‘-‘),
    (86107, 15099, ‘_yoast_wpseo_canonical’, ”),
    (86108, 15099, ‘_yoast_wpseo_redirect’, ”),
    (86109, 15099, ‘_yoast_wpseo_opengraph-description’, ”),
    (86110, 15099, ‘_yoast_wpseo_google-plus-description’, ”),
    (86111, 15099, ‘_dp_original’, ‘14137’),`

    Need help ??

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘have_posts and orderby’ is closed to new replies.