カスタムフィールドを使った特定記事のスタイルシート定義
<?php
$OptionCSS = '';
if (have_posts()) : while (have_posts()) : the_post();
if ($Tmp = get_post_meta($post->ID, 'CSS', true)) $OptionCSS .= $Tmp . "\n";
endwhile; endif;
if ($OptionCSS) {
$EchoOptionCss = <<<EOM
<style type="text/css">
{$OptionCSS}
</style>\n
EOM;
echo $EchoOptionCss;
}
?>
<table class="ExampleTbl" border="0">
<tbody>
<tr>
<th>キー</th>
<th>値</th>
</tr>
<tr>
<td>CSS</td>
<td>table.ExampleTbl {
margin: 1em 20px 1em 180px;
border-collapse: collapse;
}
table.ExampleTbl th ,
table.ExampleTbl td {
padding: 2px 6px;
border: 1px solid #bcc;
}
table.ExampleTbl th {
color: #366;
background: #def;
}</td>
</tr>
</tbody></table>
<tbody>
<tr>
<th>キー</th>
<th>値</th>
</tr>
<tr>
<td>CSS</td>
<td>table.ExampleTbl {
margin: 1em 20px 1em 180px;
border-collapse: collapse;
}
table.ExampleTbl th ,
table.ExampleTbl td {
padding: 2px 6px;
border: 1px solid #bcc;
}
table.ExampleTbl th {
color: #366;
background: #def;
}</td>
</tr>
</tbody></table>