functions.php
私のデータベースのテーブルからデータを取り出してHTML
の中に配置する関数を作成しました。function.phpの中にhtmlテーブルを書いてください
私の問題は、私はマージン、パディングを設定するために、このテーブル、その列と行のスタイルを設定する必要があるということです
、:
add_shortcode('persona-table', 'persona_table_shortcode');
// this function generates the shortcode output
function persona_table_shortcode($args) {
global $wpdb;
// Shortcodes RETURN content, so store in a variable to return
$content = '<table class="tabledatos">';
$content .= '<tr><th>Firstname</th><th>Lastname</th><th>Points</th></tr>';
$results = $wpdb->get_results('SELECT * FROM persona');
foreach ($results AS $row) {
$content = '<tr>';
// Modify these to match the database structure
$content .= '<td class=rowtable>' . $row->ID_per . '</td>';
$content .= '<td class=rowtable>' . $row->nombre . '</td>';
$content .= '<td class=rowtable>' . $row->apellido . '</td>';
$content .= '<td class=rowtable>' . $row->documento . '</td>';
$content .= '<td class=rowtable>' . $row->tel. '</td>';
$content .= '<tr>';
}
$content .= '</table>';
// return the table
return $content;
}
ようにすべて<td>
私はrowtable
と呼ばれるクラスを追加しましたが、私はページをリフレッシュするときに、そのクラスで定義されているスタイルを取りません。また、テーブル全体のクラスtabledatos
に見られるように引用符を使用しようとしましたが、これは動作しません。
このコードにクラスを追加してstyle.css
ファイルでカスタマイズできるようにするにはどうすればよいですか?高度な
は、あなたが 'rowtable'クラスを持っていることを確認していることを、あなたの変数を再割り当て?開発者コンソールの手がかりは? –