WordPress.org

Ready to get started?Download WordPress

Forums

Thematic
[resolved] Adding new div (10 posts)

  1. Jintro
    Member
    Posted 5 months ago #

    I've been working on my first theme for WP with thematic. I don't have much experience with PHP or CSS. But the code and design is clear enough to learn fast. I understand the functions and hooks. And modified alot of CSS to match my design.

    But I keep struggling with implementing a new div. e.g. I want to add content to the footer. So i simply copy the PHP code for #siteinfo (in functions.php, add it to my childtheme's function.php. And I add some content to that div.
    Then I copy the CSS for #siteinfo and copy it to my childtheme's stylesheet.

    Now comes the newbie question:
    Why is my content in the new div not alligned with all the other content? I want it alligned and I presumed it should be, because I copied the code of a div where the content of the div is alligned with the other content on the site.

    function childtheme_sitelogo(){
    	?>
    	<div id="sitelogo">
    	   The content: a logo for the site that links back to the homepage.
    	<?php
    }
    add_action('thematic_footer','childtheme_sitelogo');
  2. Jose Castaneda
    Member
    Posted 5 months ago #

    Are you able to provide a link to the site?

  3. Jintro
    Member
    Posted 5 months ago #

    It's a childtheme i'm trying out on a WordPress installation on Wampserver for Windows, so it's offline. Sorry. Maybe I can get some more tipe on these forums once it's online.

  4. Jintro
    Member
    Posted 5 months ago #

  5. salsaturation
    Member
    Posted 5 months ago #

    Hi Jintro

    If the code is no longer in the footer and the header one is in the correct position - so which part do you need help with now? Maybe you can show the issue using a screenshot

  6. Jintro
    Member
    Posted 5 months ago #

    I was just wondering if the social_icons div is placed the 'correct' way. Just some advice on how to place a div correctly.
    I know it sounds crazy, because it is in the right place. I just want some knowledge on how to do it correctly and thus have more control on over the position of the new created divs. (Like I said, this time it was pure luck :-))

    Any good tutorial would be nice. But I wasn't able to find one.

  7. salsaturation
    Member
    Posted 5 months ago #

    Yeah the way the social div is positioned is correct

    #social_icons {
    position: relative;
    float: right;
    background: #fff;
    z-index: 101;
    }

    As it is a block the 'float: right;' tells it which side to align itself. Here is a good tutorial - http://css-tricks.com/all-about-floats/

  8. Jintro
    Member
    Posted 5 months ago #

    Thank you very much for commenting and I'll check out that tutorial.

    Can I ask for a quick tip for making the header on that website set as a link to the homepage? Or am I just getting lazy and off topic now? :-)

  9. salsaturation
    Member
    Posted 5 months ago #

    Since you added the logo as a background image rather than as img you need to add a link tag around the branding div

    <a href="<?php bloginfo('url');?>">
        <div id="branding">
          rest of the code
        </div>
        </a>
  10. Jintro
    Member
    Posted 5 months ago #

    Thanks for all the advice, I'll try it out!

Reply

You must log in to post.

About this Theme

About this Topic

Tags