how to customize post in wordpress?

I try to customize my own post using the shortcode way in wordpress. I want to display the post according to its category.


function sample_post($atts) {
      'category_name' => 'uncategorized'
   ), $atts));

  $args = array('category_name' => $category_name);
   if (have_posts()) : while (have_posts()) : the_post(); ?>
         <label><?php the_title(); ?></label>

add_shortcode('sample_post', 'sample_post');


the code is fine and I have a file in my template name content-page.php
here is the code of my content-page

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
        <h1 class="entry-title"><?php the_title(); ?></h1>
    </header><!-- .entry-header -->

    <div class="entry-content">
        <?php the_content(); ?>
            wp_link_pages( array(
                'before' => '<div class="page-links">' . __( 'Pages:', 'unite' ),
                'after'  => '</div>',
            ) );

            edit_post_link( __( 'Edit', 'foodgrower' ), '<span class="edit-link">', '</span>' );
    </div><!-- .entry-content -->

</article><!-- #post-## -->

I don’t know if I miss something about the setup or query on it. Here’s I really want to displays. I only want to display (the title of the post), but now it displays the content-page.php. I don’t get it also why it appears in my page. I didn’t call the content-page.php to display in my page

Read more here: how to customize post in wordpress?

Leave a Reply

Your email address will not be published. Required fields are marked *