Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How to control order of display on WordPress custom fields?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #29021
    RayGulick
    Member

    I cannot find any info that I find the least bit understandable about how to control the order of custom fields display. By default, the data displays in the order in which it was entered. My client would like to determine the order in which it appears manually. How do I allow this? Here’s the code on the template:

    <?php
    $catleftgroup = get_post_meta($post->ID, ‘cat-left’, false);
    foreach ($catleftgroup as $catleft) {
    echo ‘<div class="category">’.$catleft.'</div>’;
    }
    ?>

    The data for each "cat-left" custom field looks like this:

    <a href="link-to-detail-page"><img src="thumbnailimage.jpg" alt="Item Name" /></a>
    <h3>Item Name Here</h3>
    <p>Short description and link to detail page</p>

    I want to control the order in which the divs with a class "category" appear on the page. How do I get there?

Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.