Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Help Formatting A Repeating Field Date

$
0
0

Hello,

I have 2 questions:

So, I've managed to get my template to correctly display the loop for a repeater field, but the date is displaying what appears to be a UNIX timestamp (see screenshot). How do I format that date to match the WordPress default, or a custom structure?

You may also notice that the invoice list is displaying the most recently added repeater field first. How do I reverse the order for a child post repeater field? It seems not to like default PHP array values here.

Your help is very appreciated.

<?php    
    $child_posts = types_child_posts("invoice_field");     /* HOW DO I REVERSE THE ORDER? */			
			
    foreach ($child_posts as $child_post) {
        print '<p style="height:24px; margin:-5px 0 0 0;"><a href="'; 
            echo $child_post->fields["invoice_file"];
            print '" target="_blank">';
	    print '<span class="file-download" title="Download File">&nbsp;</span>';
	    print '</a>'; 

                $var2_name = $child_post->fields["invoice_status"];
		if ($var2_name == "1") {
		    print '<span class="paid" title="Paid">&nbsp;</span>';
		} elseif ($var2_name == "2") {
		    print '<span class="payment-due" title="Payment Due">&nbsp;</span>';
		} elseif ($var2_name == "3") {
		    print '<span class="cancelled" title="Cancelled">&nbsp;</span>';
		}

        echo $child_post->post_title;
	print ' (';
	echo $child_post->fields["invoice_date"];     /* HOW DO I FORMAT THE DATE? */	
	print ')</p>';
    }
?>

Viewing all articles
Browse latest Browse all 20145

Trending Articles