Last active
February 13, 2024 07:54
-
-
Save taniarascia/077b98e61ac6baf9e44b to your computer and use it in GitHub Desktop.
Common Wordpress queries
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
/* | |
the_ and get_the are two different queries. For example, the_title(); will echo out the title field into your HTML document, and get_the_title(); can be inserted into a value. | |
*/ | |
<?php the_title(); ?> // Title | |
<?php the_content(); ?> // Full entry | |
<?php the_excerpt(); ?> // Partial entry | |
<?php the_permalink(); ?> // Calls a specific link | |
<?php the_category(); ?> // Calls the category |
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
<?php wp_reset_query(); ?> // Stop other loops. Sometimes necessary. | |
<?php if(is_page(78)) { | |
echo '1'; | |
} else { | |
echo '2'; | |
} ?> | |
<?php wp_list_pages('title_li=&exclude=268,276'); ?> | |
// Exclude page from list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment