Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #5880


    i’d like to know how it is possible to let the page content be shown.

    lets say i have a page with some text. if i set it to the portfolio template, you cannot see the text.

    i tried <?php the_content(); ?> but it won’t work.

    best regards




    the portfolio (overview) pages don’t support additional content but display portfolio items only. I’m sorry.


    hey dude,

    it is possible if you extent the functions.php of the them with the following code:



    function getPageContent($pageId)






    global $wpdb;

    $sql_query = ‘SELECT DISTINCT * FROM ‘ . $wpdb->posts .

    ‘ WHERE ‘ . $wpdb->posts . ‘.ID=’ . $pageId;

    $posts = $wpdb->get_results($sql_query);



    foreach($posts as $post)


    return nl2br($post->post_content);





    in the in the template_portfolio.php choose the place where you like to display the portfolio page content and type:

    <?php echo getPageContent(id); ?>

    id = the page id from your portfolio page

    this works quite well for my needs.


    Thanks for your code snippet/input – it will help other users for sure :)



    I am wanting to use the above code as it is rather nifty and simple solution to adding content above the pictures on the portfolio pages. However I wish to call a different set of content dependant on which page you are on (I have multiple portfolio template pages).

    I had a go and in the end I managed a piece of code which worked perfectly – BUT it only works if I use wp_reset_query(); which of course then kills off the rest of the page and means I get the top content, but not the gallery underneith… there seems to be a conflict between my additional query and the one which calls in the content for the page template although I am unsure where or why.

    I left the function alterations as the code above and altered the code in the template_portfolio.php page to the below:




    echo getPageContent(1099);

    } elseif(is_page(5)){

    echo getPageContent(5);

    } else {

    echo getPageContent(1096);



    Without the wp_reset_query(); the page always displays the else echo call regardless of page. Any ideas of a workaround guys?

    Thanks in advance!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘show page content in portfolio’ is closed to new replies.