• 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)
  • 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

    (@bhargavdt3)

    in which case we use loops

    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, not a ‘standard’ while(),for() or foreach() loop in PHP.

    Thread Starter bhargavdt3

    (@bhargavdt3)

    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

    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

    (@bhargavdt3)

    ok

    Thread Starter bhargavdt3

    (@bhargavdt3)

    Even i have another doubt here, how to change background for perticular pages, and how to construct different headers for different pages.

    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.