Ich habe eine Funktion erstellt auf functions.php
Datei, die Daten aus einer Tabelle in unserer Datenbank abruft und legt sie in einem HTML
.style eine HTML-Tabelle in functions.php wordpress
Mein Problem ist, dass ich diese Tabelle, um Stil, seine Spalten und Zeilen, um die Ränder, Polsterung einzustellen usw.
Das ist, was ich bisher habe:
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;
}
Wie Sie können auf jeder <td>
Ich habe eine Klasse namens: rowtable
hinzugefügt, aber wenn ich die Seite aktualisieren, nimmt die Tabelle nicht den Stil für diese Klasse definieren. Außerdem habe ich versucht, Zitate zu verwenden, wie Sie auf der Klasse tabledatos
für die gesamte Tabelle sehen können, aber das funktioniert nicht.
Wie kann ich Klassen zu diesem Code hinzufügen, damit ich sie auf der style.css
Datei anpassen kann?
Vielen Dank im fortgeschrittenen
Sind Sie sicher, dass Sie 'rowtable' Klasse haben? Irgendwelche Hinweise in der Entwicklerkonsole? –