WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help getting footer copyright text centred (9 posts)

  1. martinrowan
    Member
    Posted 4 months ago #

    Hi, I've helping to develop a website for our local Scouting group. This is my first venture in to WordPress and whilst things are going fairly well so far I've a few issues I've been able to solve so having found so much useful information here already I figure I might get some much needed help to.

    I've created a child theme based on Twenty Thirteen, a mock up of the site is currently live at: http://stage.1stwoosehill.org.uk/

    The issue I have is with the very bottom copyright footer. If you look at the stage site, you'll see that I have had to insert and extra blank line <BR />. This is because without it the first line of the copyright section doesn't centre correctly.
    I've removed the extra break on a dev site to show you what happens here.

    If I use firebug or Chrome's inspector it appears to indicate that the problem is with a margin which is defined for all <p>, however my attempts to remove it for the copyright section doesn't seem to have made a difference.

    I know I probably need to provide a bit more info and code snippets, so just let me know and I'll reply with what I can.

    [Update]
    I've shared the code via pastebin.
    footer.php from dev site without the BR
    footer.php from the stage site with the BR
    child theme css - just in case

    Any help here would be appreciated.
    Martin

  2. WPMU DEV
    Member
    Posted 4 months ago #

    Hi Martin,

    I hope you are well today and thank you for your question.

    Can you just try adding following code replacing existing one in footer.php file of your theme?

    <div class="copyright">
    		<p>
    			<?php echo 'Copyright &copy; ' . date("Y") . ' ' . get_bloginfo('name'); ?>, all rights reserved | Charity number: 801523<br />Theme derived from the <a href="<?php echo esc_url( __( 'http://wordpress.org/twentythirteen','twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Twenty Thirteen Theme', 'twentythirteen' ); ?>"><?php printf( __( '%s', 'twentythirteen' ), 'Twenty Thirteen' ); ?></a> | Reworked by: Martin Rowan
    		</p>
    </div>

    Best Regards,

  3. martinrowan
    Member
    Posted 4 months ago #

    Hi I've pasted that code to replace the code I had on the dev. site, and it's still the same. In fact I can't actually see what is different from what was there originally on the dev site.

    Martin

  4. WPMU DEV
    Member
    Posted 4 months ago #

    Hi Martin,

    There was spacing difference between two.

    Try adding following code, replacing existing one.

    <div class="copyright">
    		<div class="aligncenter"><?php echo 'Copyright © ' . date("Y") . ' ' . get_bloginfo('name'); ?>, all rights reserved | Charity number: 801523</div><div class="aligncenter">Theme derived from the <a href="<?php echo esc_url( __( 'http://wordpress.org/twentythirteen','twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Twenty Thirteen Theme', 'twentythirteen' ); ?>"><?php printf( __( '%s', 'twentythirteen' ), 'Twenty Thirteen' ); ?></a> | Reworked by: Martin Rowan</div><p></p>
    </div>

    Regards,

  5. martinrowan
    Member
    Posted 4 months ago #

    Hi. Thanks for the clarification. I've applied the updated footer, but no change the first line still isn't aligned.
    N.B. I've also updated to WP 3.8, just in case that would have helped. But it hasn't.

    Could the problem be something incorrect before the copyright block which is causing this weird alignment issue?
    Thanks Martin

  6. WPMU DEV
    Member
    Posted 4 months ago #

    Hi Martin,

    It works when i try it in browser but the same code doesn't work when you add it in your theme.

    Maybe due to spacing issue, try removing paces and add whole code in one line. Try using the following code.

    <div class="copyright"><p></p><div class="aligncenter"><?php echo 'Copyright © ' . date("Y") . ' ' . get_bloginfo('name'); ?>, all rights reserved | Charity number: 801523</div><div class="aligncenter">Theme derived from the <a href="<?php echo esc_url( __( 'http://wordpress.org/twentythirteen','twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Twenty Thirteen Theme', 'twentythirteen' ); ?>"><?php printf( __( '%s', 'twentythirteen' ), 'Twenty Thirteen' ); ?></a> | Reworked by: Martin Rowan</div><p></p></div>

    Regards,

  7. martinrowan
    Member
    Posted 4 months ago #

    Thanks for your help. The code you provided worked! Yipee!

    I was able to remove the use of the aligncenter class and still keep it working. End result:

    <div class="copyright"><p></p><?php echo 'Copyright © ' . date("Y") . ' ' . get_bloginfo('name'); ?>, all rights reserved | Charity number: 801523
    		Theme derived from the <a>" title="<?php esc_attr_e( 'Twenty Thirteen Theme', 'twentythirteen' ); ?>"><?php printf( __( '%s', 'twentythirteen' ), 'Twenty Thirteen' ); ?></a> | Reworked by: Martin Rowan
    	</div>

    Thanks again for your all your help.
    Martin

  8. martinrowan
    Member
    Posted 4 months ago #

    Ah spoke too soon. It appears to remove/fix the centering issue on the copyright section. But the purple footer above it appears to have gained a extra blank line causing it to be wider than I wanted.

    I switched back to the code you supplied too, just in case it was slight changes that broke it, but both have the same outcome.

  9. martinrowan
    Member
    Posted 4 months ago #

    Fixed it!
    Went back to my original code, then started to remove the section above the copyright section, when I removed all but the CEOP image all was fine, added the links on the bottom right and it went out of alignment again.

    I found by adding clear: both, to by definition of .copyright it fixed it.

    .copyright {
    	background-color: #fff;
    	color: #001323; /* Scout Black */
    	font-size: 0.8em;
    	padding: 0px 0;
    	text-align:center;
    	margin: 0px;
    	clear: both;
    }

    Thanks again for all your help.

Reply

You must log in to post.

About this Topic