list_meta

函式
list_meta ( $meta )
引數
  • (array) $meta
    Required:
定義位置
相關方法
_list_meta_rowregister_metahas_metathe_metadelete_meta
引入
1.2.0
棄用
-

list_meta: 這是WordPress中的一個函式,顯示一個文章或頁面的後設資料。你可以在你的主題的模板檔案中使用這個函式來顯示後設資料,如一個文章或頁面的作者、日期和類別。

在自定義欄位元框中輸出一個文章的公共後設資料。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function list_meta( $meta ) {
// Exit if no meta.
if ( ! $meta ) {
echo '
<table id="list-table" style="display: none;">
<thead>
<tr>
<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
<th>' . __( 'Value' ) . '</th>
</tr>
</thead>
<tbody id="the-list" data-wp-lists="list:meta">
<tr><td></td></tr>
</tbody>
</table>'; // TBODY needed for list-manipulation JS.
return;
}
$count = 0;
?>
<table id="list-table">
<thead>
<tr>
<th class="left"><?php _ex( 'Name', 'meta name' ); ?></th>
<th><?php _e( 'Value' ); ?></th>
</tr>
</thead>
<tbody id='the-list' data-wp-lists='list:meta'>
<?php
foreach ( $meta as $entry ) {
echo _list_meta_row( $entry, $count );
}
?>
</tbody>
</table>
<?php
}
function list_meta( $meta ) { // Exit if no meta. if ( ! $meta ) { echo ' <table id="list-table" style="display: none;"> <thead> <tr> <th class="left">' . _x( 'Name', 'meta name' ) . '</th> <th>' . __( 'Value' ) . '</th> </tr> </thead> <tbody id="the-list" data-wp-lists="list:meta"> <tr><td></td></tr> </tbody> </table>'; // TBODY needed for list-manipulation JS. return; } $count = 0; ?> <table id="list-table"> <thead> <tr> <th class="left"><?php _ex( 'Name', 'meta name' ); ?></th> <th><?php _e( 'Value' ); ?></th> </tr> </thead> <tbody id='the-list' data-wp-lists='list:meta'> <?php foreach ( $meta as $entry ) { echo _list_meta_row( $entry, $count ); } ?> </tbody> </table> <?php }
function list_meta( $meta ) {
	// Exit if no meta.
	if ( ! $meta ) {
		echo '
<table id="list-table" style="display: none;">
	<thead>
	<tr>
		<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
		<th>' . __( 'Value' ) . '</th>
	</tr>
	</thead>
	<tbody id="the-list" data-wp-lists="list:meta">
	<tr><td></td></tr>
	</tbody>
</table>'; // TBODY needed for list-manipulation JS.
		return;
	}
	$count = 0;
	?>
<table id="list-table">
	<thead>
	<tr>
		<th class="left"><?php _ex( 'Name', 'meta name' ); ?></th>
		<th><?php _e( 'Value' ); ?></th>
	</tr>
	</thead>
	<tbody id='the-list' data-wp-lists='list:meta'>
	<?php
	foreach ( $meta as $entry ) {
		echo _list_meta_row( $entry, $count );
	}
	?>
	</tbody>
</table>
	<?php
}

常見問題

FAQs
檢視更多 >