Remove footer from posts with php

Hi!

I would like to remove footer from my posts -not via css, I would like that it does`t appears even on html!

How can I do that? I already set up a child theme.

Thanks in advice

If you don’t want it done by css, you’ll have to setup a child theme and adit the .php file of the singel post layout. You should also disable the footer widget area if you’re using that.

Hi MacMartino, thanks for your reply.

I already set up a child theme, I just don`t know how to edit that file. Also I need the footer just in the main page

Hi there,

It should be the colophon.php that is located in /wp-content/themes/x/framework/views/footer/. Make a copy of the file and add it in the same directory in the child theme and edit the code to:

<?php

// =============================================================================
// VIEWS/FOOTER/COLOPHON.PHP
// -----------------------------------------------------------------------------
// Colophon markup.
// =============================================================================

$atts = x_atts( array(
  'class' => 'x-colophon',
  'role'  => 'contentinfo'
) );

?>

<?php do_action( 'x_before_colophon_begin' ); ?>

  <?php if( is_home() ) : ?>

      <footer <?php echo $atts; ?>>
    
        <?php do_action( 'x_after_colophon_begin' ); ?>
    
        <?php do_action( 'x_colophon' ); ?>
    
        <?php do_action( 'x_before_colophon_end' ) ?>
    
      </footer>
  
  <?php endif; ?>

<?php do_action( 'x_after_colophon_end' ); ?>

Hope this helps.

How do I disable footer in posts?

Hi There,

Could you please try using the following code instead.

<?php

// =============================================================================
// VIEWS/FOOTER/COLOPHON.PHP
// -----------------------------------------------------------------------------
// Colophon markup.
// =============================================================================

$atts = x_atts( array(
  'class' => 'x-colophon',
  'role'  => 'contentinfo'
) );

?>

<?php do_action( 'x_before_colophon_begin' ); ?>

<?php if (!is_singular('post')) : ?>

  <footer <?php echo $atts; ?>>

  	<p>dfgdfgdf</p>
  	
    <?php do_action( 'x_after_colophon_begin' ); ?>

    <?php do_action( 'x_colophon' ); ?>

    <?php do_action( 'x_before_colophon_end' ) ?>

  </footer>
<?php endif; ?>

<?php do_action( 'x_after_colophon_end' ); ?>

Hope that helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.