Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think I answered this one on my own!</p> <p>I created a for loop in my show meta box function like so:</p> <pre><code>//Show Meta Fields function products_show_meta() { global $meta_box, $post, $prefix; // Use nonce for verification echo '&lt;input type="hidden" name="products_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" /&gt;'; echo '&lt;table class="widefat"&gt;', '&lt;thead&gt;', '&lt;tr&gt;', '&lt;th style="width:30%"&gt;Document Name&lt;/th&gt;', '&lt;th&gt;Document URL&lt;/th&gt;', '&lt;/tr&gt;', '&lt;thead&gt;', '&lt;tfoot&gt;', '&lt;tr&gt;', '&lt;th&gt;Document Name&lt;/th&gt;', '&lt;th&gt;Document URL&lt;/th&gt;', '&lt;/tr&gt;', '&lt;tfoot&gt;'; echo '&lt;tbody&gt;'; for ($i=1; $i &lt;= count($meta_box["fields"])/2; $i++) { $current_docName = $prefix . 'docname' . $i; $current_docUrl = $prefix . 'docurl' . $i; $meta_docName = get_post_meta($post-&gt;ID, $current_docName, true); $meta_docUrl = get_post_meta($post-&gt;ID, $current_docUrl, true); echo '&lt;tr&gt;', '&lt;td&gt;', '&lt;input type="text" name="', $current_docName, '" id="', $current_docName, '" value="', $meta_DocName ? $meta_DocName : '', '" size="30" style="width:99%" /&gt;', '&lt;/td&gt;', '&lt;td&gt;', '&lt;input type="text" name="', $current_docUrl, '" id="', $current_docUrl, '" value="', $meta_DocUrl ? $meta_DocUrl : 'http://', '" size="30" style="width:99%" /&gt;', '&lt;/td&gt;', '&lt;/tr&gt;'; } echo '&lt;/tbody&gt;', '&lt;/table&gt;'; </code></pre> <p>First I echo out the header and footer of the table, giving each column the appropriate name. Then I run a <code>for</code> loop that starts at 1 and counts the number of fields I have ( I have to divide it by 2 otherwise it doubles up the rows). Then I just grab each field and echo out the row. This is what the code below renders: <a href="http://i.stack.imgur.com/NPu66.png" rel="nofollow">http://i.stack.imgur.com/NPu66.png</a> It's working and saving the data perfectly!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload