Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #524485

    Hi, I would like to know what would be the php code for a basic template where i can get the content of a page to display like if I use the defaut template.

    To explain more in details here is some explanations :

    I want to create a different page template that i can apply to any of my site pages that woul work just you default template but where i can add some conditionnal php, apply filters or display a must login message instead of the content.

    I already have something close to what i need, but it actually add some padding and margin around my content :

    
    <?php
    /*
    Template Name: NEED LOGIN
    */
    global $avia_config;
    /*
    * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    */
    get_header();
    
    if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
    do_action( 'ava_after_main_title' );
    ?>
    
    <div class='container_wrap container_wrap_first main_color fullsize<?php //avia_layout_class( 'default' ); ?>'>
    
    <div class='container'>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('slider') ) : ?>
    <?php endif; ?>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('property-search') ) : ?>
    <?php endif; ?>
    
    <main class='template-page content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' =>
    'content','post_type'=>'page'));?>>
    
    <?php
    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    */
    
    $avia_config['size'] = avia_layout_class( 'main' , false) == 'entry_without_sidebar' ? "" : 'entry_with_sidebar';
    //get_template_part( 'includes/loop', 'page' );
    
    	 $id = get_the_ID();
    	 $page_data = get_page( $id ); 
    	 $link = get_permalink( $id ); 
    
    	$content = $page_data->post_content;
    	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    
    if ( is_user_logged_in() ) {
    	echo $content;
    } else {
    	echo 'Vous devez être connecté pour accéder à cette page. <a href="/login">Cliquez ici</a> pour vous connecter ou vous inscrire.';
    }
    
    ?>
    <!–end content–>
    </main>
    
    <?php
    //get the sidebar
    $avia_config['currently_viewing'] = 'page';
    get_sidebar();
    ?>
    
    </div><!–end container–>
    
    </div><!– close default .container_wrap element –>
    <?php get_footer(); ?>
    
    #524502

    Hey lepetitweb!

    I am sorry, but to understand clearly, you want to remove the margins / paddings?

    Cheers!
    Basilis

    #524517

    no I simply want a very simple template who is going to display pages like normal template but that i can use on my developpement template

    #524671

    found it… kinda stupid of me…

    I only had to use the page.php in enfold folder as template sample since it’s for pages…

    Thanks for the help tho

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘basic template’ is closed to new replies.