1. List of taxonomy
<?php
//list terms in a given taxonomy
$taxonomy = 'industry';
$tax_terms = get_terms($taxonomy);
?>
<ul>
<?php
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
?>
</ul>
2. List of all categories for post
<?php wp_list_categories(); ?>
3. List of All Post types
<?php
foreach ( get_post_types( '', 'names' ) as $post_type ) {
echo '<p>' . $post_type . '</p>';
}
?>
4.List of all Post for custom Post type.
$query = new WP_Query( array( 'post_type' => 'book' ) );
while ( $query->have_posts() ) : $query->the_post();
echo '<li><a href="';
the_permalink();
echo '">';
the_title();
echo '</a></li>';
endwhile;
5. Important Template Files:
header.php (displays the header area)
footer.php (displays the footer area)
index.php (shows your latest blog posts)
single.php (shows a single blog post)
page.php (displays static page)
sidebar.php (displays the sidebar)
archive.php (shows blog archives)
<?php
//list terms in a given taxonomy
$taxonomy = 'industry';
$tax_terms = get_terms($taxonomy);
?>
<ul>
<?php
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
?>
</ul>
2. List of all categories for post
<?php wp_list_categories(); ?>
3. List of All Post types
<?php
foreach ( get_post_types( '', 'names' ) as $post_type ) {
echo '<p>' . $post_type . '</p>';
}
?>
4.List of all Post for custom Post type.
$query = new WP_Query( array( 'post_type' => 'book' ) );
while ( $query->have_posts() ) : $query->the_post();
echo '<li><a href="';
the_permalink();
echo '">';
the_title();
echo '</a></li>';
endwhile;
5. Important Template Files:
header.php (displays the header area)
footer.php (displays the footer area)
index.php (shows your latest blog posts)
single.php (shows a single blog post)
page.php (displays static page)
sidebar.php (displays the sidebar)
archive.php (shows blog archives)
WordPress powers millions of websites with its flexibility, ease of use, and vast customization options. With free games on nintendo switch , you can unlock interactive designs that elevate your WordPress experience.
ReplyDelete