Created
March 23, 2015 07:58
-
-
Save webonaut/e534cf65a8d1a626a92e to your computer and use it in GitHub Desktop.
Wordpress - Informationen zu aktivem Objekt (queried object) ausgeben
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Beschreibung: Lädt alles Infos des aktuellen abgefragten Objekts und zeigt sie an; | |
// Speicherort: in irgendeinem Template; | |
// Quelle: http://codex.wordpress.org/Function_Reference/get_queried_object | |
<?php | |
$queried_object = get_queried_object(); | |
var_dump( $queried_object ); | |
?> | |
// Alternative: einzelne Werte des queried objects ausgeben: | |
<?php $variable = $wp_query->queried_object; | |
echo $variable->name; // Die obige (erste) Abfrage liefert Infos, was genau man hier in der zweiten Abfrage ausgeben möchte (z.B. statt ->"name"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment