Title: facing problems with getpost method
Last modified: August 21, 2016

---

# facing problems with getpost method

 *  [bhargavdt3](https://wordpress.org/support/users/bhargavdt3/)
 * (@bhargavdt3)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/)
 * Hi i am new to wordpress , from past two days i am juggling here and there for
   solution but i failed to get one, please help me.
    My problem is , i am using
   fiction theme in that i wanted two different headers for my pages one header 
   for home page and second header for remaining pages, and i am successful in doing
   this, so problem i am facing here is for home the content is displaying fine,
   but rest of the pages i was getting blank, so i used getpost method to fetch 
   the page what i designed using visual composer, here is the quick glance of my
   page.php
 * if (!is_page( ‘taskican home’ ))
    {
 * get_header( ‘bhargav’ );
    $post_7 = get_post(3736); $con = sanitize_post_field(‘
   post_content’, $post_7->post_content, $post->ID, ‘display’ ); echo $con; // **
   here i am facing problem, i am getting the page what i have designed but with
   no layout i.e it is displaying with layout code** get_footer(); } else{templating_singular(‘
   Page’); }
 * i am getting the output content in my pages as
    [vc_row][vc_column width=”1/1″][
   vc_column_text]
 * ( I am text block. Click edit button to change this text. sflskfjsdf sflskjflkjsdf
   sfsdkflksjdfsd fsdfmlksdjflkjsdfdsfdsfsdfdsf) my content
 * [/vc_column_text][/vc_column][/vc_row]
 * please help me i am new to wordpress

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335000)
 * To output the content of the post/page/etc you need to use either `the_content()`
   if you’re in the loop, or if outside, you can use `echo apply_filters('the_content',
   $post->post_content)`.
 *  Thread Starter [bhargavdt3](https://wordpress.org/support/users/bhargavdt3/)
 * (@bhargavdt3)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335005)
 * in which case we use loops
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335006)
 * Well, no. In the code that you’ve got there, there’s no loop. And when I say “
   the loop” that’s meant in the [WordPress meaning of it](http://codex.wordpress.org/The_Loop),
   not a ‘standard’ `while()`,`for()` or `foreach()` loop in PHP.
 *  Thread Starter [bhargavdt3](https://wordpress.org/support/users/bhargavdt3/)
 * (@bhargavdt3)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335007)
 * thank you, i will implement this and let you know, can i know your email id, 
   so that i can contact you when ever i get doubts
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335009)
 * Nope. Sorry. Support is offered via these fourms only. We’re all volunteers here
   and don’t do this as any sort of a job. You can ask anyy other questions or problems
   by creating a new post on here and you should get a good response from someone.
 *  Thread Starter [bhargavdt3](https://wordpress.org/support/users/bhargavdt3/)
 * (@bhargavdt3)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335010)
 * ok
 *  Thread Starter [bhargavdt3](https://wordpress.org/support/users/bhargavdt3/)
 * (@bhargavdt3)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335013)
 * Even i have another doubt here, how to change background for perticular pages,
   and how to construct different headers for different pages.
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335015)
 * Changing background for different pages should be done through your CSS code.
   There’s more then enough classes added to the pages `<body>` tag to let you target
   each individual page.
 * Different headers for different pages will be something like this:
 *     ```
       if(53 == $post->ID){
           get_header('special');
       }
       else{
           get_header();
       }
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘facing problems with getpost method’ is closed to new replies.

## Tags

 * [php code](https://wordpress.org/support/topic-tag/php-code/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/facing-problems-with-getpost-method/#post-4335015)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
