Gibt es einen Filter oder etwas, um diese Art von Icons-basierten Kategorien hinzuzufügen und was nicht zu allen Posts?
Ich kann anscheinend keinen finden. Ich habe versucht, the_title, aber ofc, das wird bereinigt und zeigt nur die HTML .. Danke!
Wir können die Tabelle mit CSS unddashiconsformatieren.
Für unsere Kategorie video
können wir zum Beispiel verwenden:
.edit-php .wp-list-table tr.category-video td.post-title strong:before {
content: "\f126";
color: #ccc;
display: inline-block;
width: 20px;
height: 20px;
margin: 0 4px;
font-size: 20px;
line-height: 20px;
font-family: "dashicons";
font-weight: normal;
vertical-align: top;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
wo wir die Klasse tr.category-video
anvisieren.
Schauen Sie sich einfach an, wie es im Backend verwendet wird, um sich ein Bild von den CSS-Attributen zu machen.
Wir können die Liste der Dashicons abrufen hier .
Hier ist es ist der Teil der Klasse WP_Posts_List_Table
, der das Symbol für das Post-Format anzeigt:
$pad = str_repeat( '— ', $level );
echo "<td $attributes><strong>";
if ( $format = get_post_format( $post->ID ) ) {
$label = get_post_format_string( $format );
echo '<a href="' . esc_url( add_query_arg( array( 'post_format' =>
$format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '"
class="post-state-format post-format-icon post-format-' . $format
. '" title="' . $label . '">' . $label . ":</a> ";
}