Support » Themes and Templates » Single page Theme & Template page

  • Hello everybody!

    I have been going crazy dealing with a single page theme like this one.

    I managed to have a loop of the pages in the index.php and link them through the WP menu. However when I try and give a different structure to the various sections issues arise.
    The code that I used for this loop is the following:

    <?php $args = array(
    	'sort_order' => 'ASC',
    	'sort_column' => 'menu_order', //post_title
    	'hierarchical' => 1,
    	'exclude' => '',
    	'child_of' => 0,
    	'parent' => -1,
    	'exclude_tree' => '',
    	'number' => '',
    	'offset' => 0,
    	'post_type' => 'page',
    	'post_status' => 'publish'
    $pages = get_pages($args);
    //start loop
    foreach ($pages as $page_data) {
        $content = apply_filters('the_content', $page_data->post_content);
        $title = $page_data->post_title;
        $slug = $page_data->post_name;
    <div id='<?php echo "$slug" ?>' class="section">
    <div class="contentSlide">
    <h2><?php echo "$title" ?></h2>
    <?php echo "$content" ?>
    <?php }; ?>

    This shows all the pages one after the other.

    What I want to do is assign a different structure depending on the template of the page (e.g. a different template for the gallery, one for the portfolio, one for the about page, …) with a code like that:

    <?php if ( !is_page_template ('pagePortfolio.php')) { ?>
    <div class="some_class_for_portfolio_page">SOME CONTENT</div>
    <?php } else { ?>
    <div class="some_class_for_not_portfolio_page">SOME DIFFERENT CONTENT</div>
    <?php } ?>

    ….but that does not work at all 🙁
    Anyone has an idea? Pleeeeeease <3<3<3

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Single page Theme & Template page’ is closed to new replies.