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

    hello

    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

    thomas

    #52063

    Hey,

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

    #52064

    hey dude,

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

    if(!function_exists(‘getPageContent’))

    {

    function getPageContent($pageId)

    {

    if(!is_numeric($pageId))

    {

    return;

    }

    global $wpdb;

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

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

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

    if(!empty($posts))

    {

    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.

    #52065

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

    #52066

    Hi,

    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:

    <?php

    wp_reset_query();

    if(is_page(1099)){

    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.