Need Help with Worpress PHP file

Discussion in 'PHP' started by Cheap SEO Services, Nov 15, 2006.

  1. #1
    I am trying to put a bit of script code into the header part. I think it goes in the style section.

    Any help here? I can show you the code.

    Thanks,

    Col :)
     
    Cheap SEO Services, Nov 15, 2006 IP
  2. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You have two options as far as I know.

    You can look for a plugin that allows you to insert html into the header. I know a plugin like this exists for serendipity but I'm not as familiar with wordpress.

    The second option is to modify the template by hand. If you choose this option you'll need to be careful with you syntax. Again I don't know what wordpress uses to parse the templates but in serendipity the smarty templating engine is used. As a result your css or javascript needs to be contained within I think it is {literal}{/literal} tags. It could well be different in wordpress though.
     
    streety, Nov 15, 2006 IP
  3. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have looked for a plugin but could not make heads or tails of which one is the right one or if it is one at all. The descriptions on some are woeful.

    Syntax is quite different in mine. I'll post a snippet of the code down to the header:


    body {
    background:#fff url(images/bgbody.jpg) repeat-x top left;
    font-size: 11px;
    font-family: Verdana, Arial, SunSans-Regular, Sans-Serif;
    padding:0px;
    margin:0px;
    }

    ol,ul,form,p,h1,h2,h3,h4,fieldset{margin:0; padding:0;}

    a{text-decoration:none; color:#000;}

    /* ----------container zentriert das layout-------------- */
    #container {
    width: 735px;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    }

    /* ---------- header -------------- */
    #header {
    padding: 0px;
    margin: 0px;
    height:211px;
    position:relative;
    }
    #imgsoccerball{position:absolute; bottom:0; left:0; background:url(images/soccerball.jpg) no-repeat; width:159px; height:143px;}

    html > body #imgsoccerball{bottom:1px;} /* because ie */

    #topmenu{height:25px; padding-top:5px; background:#000;}

    #topmenu li{float:left; list-style-type:none; padding:3px 10px 3px 10px; border-right:solid 1px #fff;}

    #topmenu a{text-decoration:none; color:#BBDAE0; font-weight:bold;}
    #topmenu a:hover{color:#FF9900;}

    #titlesite{text-align:center; margin-top:10px;}
    #titlesite h1{font-size:35px; font-weight:bold;}
    #titlesite h2{font-size:18px; color:#FF9900;}
     
    Cheap SEO Services, Nov 15, 2006 IP
  4. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #4
    Wordpress doesn't use smarty templates. It's regular html with some php code.

    Col, you have to edit the header.php file in the themes folder. Add your code in and save it.
     
    Colleen, Nov 15, 2006 IP
  5. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can you help with an example? Maybe?? ;)
     
    Cheap SEO Services, Nov 15, 2006 IP
  6. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #6
    If that's the code above, you paste it into the themes stylesheet and save it. It's just copy and paste.

    Either way, just copy your code, paste it in the header above </head>, save. Preview site. If it's css, paste it in the stylesheet, save and preview.
     
    Colleen, Nov 15, 2006 IP
  7. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi,

    Check out my post about Page Title Optimisation in WordPress. It's not exactly what you're looking for, but it'll give you an idea on how to edit the theme. Just, instead of the header.php file, edit the style.php (Stylesheet).

    WordPress SEO - Page Title Optimization
     
    geniosity, Nov 15, 2006 IP
  8. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Am I in the right section? I am in Manage-Files but the whole list of files to edit are not showing. Just some in Common and Recent??:confused:
     
    Cheap SEO Services, Nov 15, 2006 IP
  9. geniosity

    geniosity Peon

    Messages:
    293
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Quoted from my page:

    Other than that, looks like you're lost.
     
    geniosity, Nov 15, 2006 IP
  10. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #10
    LOL. I can see them all now. Thanks!!! :)

    Now this is what I see. Where should I place my adsense code?:

    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
    <style type="text/css" media="screen">
    @import url( <?php bloginfo('stylesheet_url'); ?> );
    </style>
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />

    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php wp_get_archives('type=monthly&format=link'); ?>
    <?php //comments_popup_script(); // off by default ?>
    <?php wp_head(); ?>
    </head>
     
    Cheap SEO Services, Nov 15, 2006 IP
  11. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #11
    Adsense code wouldn't go in there. It has to go below <body>, index.php is the file you'd more than likely want it in, or below <body> in the header, if the body tag is in your header.

    You can't edit the files either if the permissions aren't set to allow you to and with wordpress they're normally not, you have to go into FTP and chmod the template files to 666. If it's hosted with Wordpress.com maybe they already set them, but I don't know how you're hosting it. So either way...
     
    Colleen, Nov 15, 2006 IP
  12. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Hmmmm. This is what I can see. Notice where the cursor is? Is this the <body? tag you are referring to?

    [​IMG]
     

    Attached Files:

    Cheap SEO Services, Nov 15, 2006 IP
  13. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #13
    Yes, that's the tag, content goes under it.
     
    Colleen, Nov 15, 2006 IP
  14. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #14
    I ended up working it out successfully. You can see at www.livefootballbusiness.com

    Thanks for all your help!!

    Col :)
     
    Cheap SEO Services, Nov 15, 2006 IP
  15. Colleen

    Colleen Illustrious Member

    Messages:
    6,777
    Likes Received:
    725
    Best Answers:
    1
    Trophy Points:
    430
    #15
    Wow, that's a very nice theme, Col! Good work! ;)
     
    Colleen, Nov 15, 2006 IP
  16. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #16
    LOL. It's only the beginning. I have big plans for this site.

    Col :)
     
    Cheap SEO Services, Nov 15, 2006 IP
  17. Cheap SEO Services

    Cheap SEO Services <------DoFollow Backlinks

    Messages:
    16,664
    Likes Received:
    1,318
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Seems this site is not looking crash hot in IE6.0. I would like some help here if anyone can offer it?

    Thanks,

    Col :)
     
    Cheap SEO Services, Nov 16, 2006 IP
  18. Ahmed3335

    Ahmed3335 Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Put the code in <Body> </body> tags... :)
     
    Ahmed3335, Feb 19, 2012 IP