Tagged: template
-
AuthorPosts
-
October 25, 2015 at 8:58 pm #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(); ?>
October 25, 2015 at 10:12 pm #524502Hey lepetitweb!
I am sorry, but to understand clearly, you want to remove the margins / paddings?
Cheers!
BasilisOctober 25, 2015 at 10:41 pm #524517no 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
October 26, 2015 at 7:31 am #524671found 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
-
AuthorPosts
- The topic ‘basic template’ is closed to new replies.