How to show Multiple post in wordpress on single page?

18:29:00 0 Comments A+ a-

In wordpress you can show your post many way. All are depend on your needs and website requirement like many time you want to show only one post and many time you want to multiple post in a page. we are already discussed about that how can we show single post in our website.

Now we learn how we show multiple post in sinlge page.

You have just put this code to your php page given below
 
             
   
       



Now all posts are showing on your page.



====================================================


but if you want to show limited post on your page then you will edit your code like this
$query = new WP_Query( array('posts_per_page'=> '5') ); 

 

 if ( $query->have_posts() ) : 
       while ( $query->have_posts() ) : $query->the_post();
             get_template_part( 'content', get_post_format() ); 
       endwhile; 
  endif;

  
$query = new WP_Query( array('posts_per_page'=> '5') ); 
 
 if ( $query->have_posts() ) : 
       while ( $query->have_posts() ) : $query->the_post();
             get_template_part( 'content', get_post_format() ); 
       endwhile; 
  endif;
 
==================================================

and if you want to show post of any single category then you can edit your code like this


$query = new WP_Query( array('category_name'=>'news',  
                             'posts_per_page'=> '5') ); 
  if ( $query->have_posts() ) : 
       while ( $query->have_posts() ) : $query->the_post();
             get_template_part( 'content', get_post_format() ); 
       endwhile; 
  endif;


in above code i have just add category name which is news


For more information about WordPress learn my blog continuously ..... thanks


How to show single post content in wordpress

18:28:00 0 Comments A+ a-



If you want to show single post content anywhere in your website and if you want to show any part of your post like
  1. Title
  2. Subtitle
  3. Content 
  4. Feature image etc.
you just have copy and paste below code


P=THE ID OF YOUR POST!
Then the whole content of the post will be shown there.

How to change wordpress theme name

18:28:00 0 Comments A+ a-


When you work on wordpress you will found many themes by default. which is provided by the wordpress to you at the time of installation of wordpress.
like

  1. twentytwelve
  2. twentythirteen
  3. twentyfourteen
But you can also use your custom name instant of these names .
For make your own custom theme you have just follow some steps and you will do it easily.



step1- go to wp-content\themes

you will find some folder like this
then change the name of your folder as you want.

In below screenshots i have change twentyfouteen folder name into mysite




Step-2  Change name in css file

                  After that open the same folder
                 open css file named style.css
    
                 mysite>style.css
 /* Theme Name: mysite 

Theme URI: the-theme's-homepage 

Description: a-brief-description 

Author: your-name Author URI: your-URI 

Template: use-this-to-define-a-parent-theme--optional 

Version: a-number--optional . General comments/License Statement if any. . */
Step3  Re-activate theme form wordpress admin

After the change of css file name you have to reactivate your theme 

Go to    Admin dashboard > appearence > activate your theme with new name

now refresh your URL on browser your theme name has been change now.


thanks for reading ....  Enjoy