How reterive posts content from a specific category in wordpress website?


Hello Everyone!

If you want to display the post lists from a specific category, then don’t worry i am here for you only. just use my code (given below) .

For do this you have not require any technical knowledge, just copy and paste my code.


<ul>        
<?php  
        // 
        $args = array( 'posts_per_page' =>20,'category' => 1 ); //here CAT ID is 1

        $myposts = get_posts( $args ); 

        foreach ( $myposts as $post ) : setup_postdata( $post ); ?> 

             <li> 

             <?php 
              echo $post->post_title; 
              /* echo $post->post_content; //uncomment this if you you want display post content */
             ?>
            </li> 

        <?php 
              endforeach;  
             wp_reset_postdata(); 

         ?>
</ul>

Enjoy and share my blog with your friends !:)!

Advertisements

Sr. Software Engineer

Tagged with: , , ,
Posted in Wordpress
11 comments on “How reterive posts content from a specific category in wordpress website?
  1. I’m not sure exactly why but this blog is loading extremely slow for me.
    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later and see if the problem still exists.

  2. Leonida says:

    It is the best time to make a few plans for the longer term and it is time to be happy. I’ve read this publish and if I could I desire to suggest you few attention-grabbing issues or suggestions. Perhaps you can write subsequent articles referring to this article. I want to learn even more things about it!

  3. Julissa says:

    Hello there! I just wish to give you a huge thumbs up for your excellent information you have right here on this post. I am returning to your website for more soon.

  4. Mariano says:

    I was curious if you ever thought of changing the page layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or 2 images. Maybe you could space it out better?

  5. Mckinley says:

    Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is excellent, let alone the content!

  6. Tamika says:

    Great work! That is the kind of information that are supposed to be shared across the net. Shame on the search engines for now not positioning this post upper! Come on over and discuss with my site . Thanks =)

  7. Silke says:

    I was recommended this blog by my cousin. I’m no longer certain whether this submit is written via him as nobody lse realize such special approximately my trouble.

    Youu are incredible! Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: