0

I am working on a WordPress theme and I have some problem with the pages\posts layout.

For example if you go here: http://lnx.asper-eritrea.com/lassociazione/

This is a static page that show some text (and it is ok) but why under the text it is shown the possibility to let a comment and under it a calendar, categories, archive and meta?

What can I do to don't have these things showed in my pages? Have I to modify the code of the pages template?

This is the code of my page.php file:

<?php
/**
 * The Template for displaying a single page
 */

get_header();
?>

<!-- Contenuti (griglia) -->
<div class="container">
<!-- Lead presentazione -->
<section id="presentazione">
<div class="row">
<div class="col-sm-12">
<h1 class="text-center"><small>Associazione per la Tutela dei Diritti Umani del Popolo Eritreo</small></h1>
<p class="lead text-center">
Association in Defense of the Human Rights of the Eritrean People
</p>
</div><!-- /.col-sm-12 -->
</div><!-- /.row -->
</section><!-- /section presentazione -->

<div id="main-content" class="main-content">

<?php
if (is_front_page() && twentyfourteen_has_featured_posts()) {
    // Include the featured content template.
    get_template_part('featured-content');
}
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">

<?php
// Start the Loop.
while (have_posts()) : the_post();

    // Include the page content template.
    get_template_part('content', 'page');

    // If comments are open or we have at least one comment, load up the comment template.
    if (comments_open() || get_comments_number()) {
        comments_template();
    }
endwhile;
?>

</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar('content'); ?>
</div><!-- #main-content -->

<?php get_footer(); ?>
1

In the link all the content such as calendar, categories, archive, etc. are coming from the sidebar widget which most probabily defined into your page.php layout.

something like:

<?php get_sidebar( 'content' ); ?>

You need to remove this kind of sidebar code from the page.php file to not display that information.

  • Tnx so much, it is right !!! Now I am reading the documentation on get_sidebar() method and it seems to understand that is geneircally used to load some dynamic content into a page...but why is it called get_sidebar() if it is used to load content also in place that are not the sidebar? – AndreaNobili Jul 13 '14 at 15:06
  • @AndreaNobili In some themes, it is used to display the widgets which help them to show related content or some kind of information. If you don't want to display the sidebar you just need to remove the widget from the dashboard or the sidebar from the theme files. – WisdmLabs Jul 13 '14 at 15:19
1

My guess is that you have not defined a page.php template in your theme, so pages are being displayed using index.php which includes a sidebar with widgets and comment form.

Edit:

Looking at the code in your updated question, you can remove the following:

// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() || get_comments_number()) {
     comments_template();
}

and:

<?php get_sidebar('content'); ?>
  • mmm tnx but I have a page.php file into my theme, I have edited the original post iserting its code. Are there something wrong? – AndreaNobili Jul 13 '14 at 14:53
  • I'll update my answer based on the code in your updated question. – karpstrucking Jul 13 '14 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.