'page',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order'
);
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) : ?>
have_posts() ) : $parent->the_post(); ?>
Category Archives: Wordpress
Template for default Post
In your functions.php file:
add_filter( 'default_content' , 'my_default_content' );
function my_default_content( $post_content ) {
$post_content = 'Hello World!';
return $post_content;
}
Source Differene between WP the_category() and get_the_category()
If you want to get the category with the link use:
If you want to get the category without the link use:
If you want to get the category without the link use:
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo esc_html( $categories[0]->name );
}
It shows only the main category and not sub-categories. Echoing out only get_the_category will return array.
Links: Code reference - get_the_categroy().