• Hey guys.
    Below is my header code.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head profile="https://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <title><?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('description'); } ?> — <?php bloginfo('name'); ?></title>
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/custom.css" type="text/css" media="screen" />
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/ie7.css" />
    <![endif]-->
    
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/ie6.css" />
    <![endif]-->
    
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    <?php wp_head(); ?>
    
    </head>
    
    <body class="custom">
    <div id="container">
    <div id="page">
    
    <ul id="nav">
    <li><a href="<?php bloginfo('url'); ?>" rel="nofollow">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&title_li=&depth=1'); ?>
    <li class="rss"><a href="<?php bloginfo('rss2_url'); ?>" title="Subscribe">SUBSCRIBE</a></li>
    </div>
    <div id="masthead">
    <div id="logo"><a href="<?php bloginfo('url'); ?>"<?php if (is_home()) echo(' rel="nofollow"'); ?>><?php bloginfo('name'); ?></a></div>
    <?php if (is_home()) { ?><h1><?php bloginfo('description'); ?></h1><?php } else { ?><div id="tagline"><?php bloginfo('description');
    ?></div><?php } ?>
    
    </div>

    I’m just wondering (because I’m not too good on coding yet! (I’m only 16), whether someone could be so generous to show make the new code I can use, removing unnecessary PHP info etc.
    If you think it’s too much work, it’s ok.
    If you can help in any way at all, much appreciated.
    Doocey.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Ayoze Perez

    (@doocey)

    BUMP!

    Anyone have any ideas – please?

    What exactly do you want to do with the code?

    if you’re just learning, dive in and change things (keeping a copy of the original) and see what breaks. And read the WP docs, too, about getting started, themes, etc…..

    Thread Starter Ayoze Perez

    (@doocey)

    I just want to get rid of unnecessary php tags etc.
    To speed up my blog.

    There’s very little that’s unnecessary in most themes. And if you want to learn php, start playing with it and reading the docs.

    If your blog is loading slow, you should learn to reduce the size of your images; they’re too large, both display size and KB size. And watch how many javascripts you load. Learn how to use Firebug in Firefox to examine your site.

    Thread Starter Ayoze Perez

    (@doocey)

    I don’t think it’s loading too slow but I’d like to have it as fast as I can.

    Are my images too large do you think?
    And where do I know how Javascripts I’m loading?
    Sorry, I’m kinda new, but I learn fast.

    Are my images too large do you think?

    Since no one has seen your site, how can they tell?

    And where do I know how Javascripts I’m loading?

    There’s very little javascript in the code example you gave above beyond what is needed to run WordPress. Additional javascript normally comes from plugins. Reduce the number of plugins you are running and you’ll almost certainly enhance your site’s performance a little.

    Thread Starter Ayoze Perez

    (@doocey)

    My bad.

    My site is https://www.tynetime.com

    As regards plugins, I actually don’t use too many. Just Wp-SpamFree, All In One SEO, Super Cache, Google Analytics, META tags and XML Sitemap one.

    IS there anyone’s there that aren’t really needed? Because as far as I know everyone of them is!

    I doubt you need Super Cache but some people swear by it. Never used it myself. Ditto All In One SEO. See:

    https://quirm.net/2009/07/02/wordpress-search-engine-optimisation/

    You do have some validation errors that need attention. Web browsers will take slightly longer to parse/display invald code.

    I found your site before by looking at the earlier questions you asked in your profile.

    If you use Firebug, you’ll see the size of your images and the too many instances of gifs loaded by addtoany.

    You’re using a cache for speed, but you’re worrying about it too much; are you getting 50K page views a day? What kind of hosting are you using?

    I don’t know who coded this mess in your header, but just for fun, I cleaned it up a bit. This won’t make it faster, but it’ll be cleaner.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head profile="https://gmpg.org/xfn/11">
    <title><?php if ( is_single() || is_page() || is_archive() ) { wp_title( '', true ); } else { bloginfo( 'description' ); } ?> &mdash; <?php bloginfo( 'name' ); ?></title>
    
    <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css" media="screen" />
    
    <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo( 'name' ); ?> RSS Feed" href="<?php bloginfo( 'rss2_url' ); ?>" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    
    <?php wp_head(); ?>
    
    </head>
    
    <body class="custom">
    
    	<div id="container">
    
    		<div id="page">
    
    			<?php echo str_replace( '<ul', '<ul id="nav"', wp_page_menu( array( 'show_home' => 'Home', 'sort_column' => 'menu_order', 'title_li' => false, 'depth' => 1, 'echo' => false ) ) ); ?>
    
    			<div id="masthead">
    
    				<div id="logo">
    					<a href="<?php bloginfo( 'url' ); ?>" title="<?php bloginfo( 'name' ); ?>"><?php bloginfo( 'name' ); ?></a>
    				</div>
    
    				<?php if ( is_home() ) { ?>
    					<h1><?php bloginfo( 'description' ); ?></h1>
    				<?php } else { ?>
    					<div id="tagline"><?php bloginfo( 'description' ); ?></div>
    				<?php } ?>
    
    			</div>

    Then, drop this in your theme’s functions.php file:

    add_action( 'template_redirect', 'my_scripts_and_styles' );
    
    function my_scripts_and_styles() {
    	global $is_IE;
    
    	$dir = get_bloginfo( 'template_url' );
    
    	wp_enqueue_style( 'custom-style', $dir . '/custom.css', false, 0.1, 'screen' );
    
    	if ( $is_IE ) {
    		$browser = $_SERVER[ 'HTTP_USER_AGENT' ];
    
    		if ( preg_match( "/MSIE 7.0/", $browser ) )
    			wp_enqueue_style( 'ie7-style', $dir . '/ie7.css', false, 0.1, 'screen' );
    
    		elseif ( preg_match( "/MSIE 6.0/", $browser ) )
    			wp_enqueue_style( 'ie6-style', $dir . '/ie6.css', false, 0.1, 'screen' );
    	}
    
    	if ( is_singular() && get_option( 'thread_comments' ) )
    		wp_enqueue_script( 'comment-reply' );
    }
    Thread Starter Ayoze Perez

    (@doocey)

    I’m using regular hosting, not dedicated.
    OK, so I’ll reduce the images sizes and use that code in my new header.
    That’s what I meant really, just to clean things up.
    Regards the Functions file.
    Do I replace the current one with that, or add it to it?

    Add to it.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Can someone help me – 2 minutes job’ is closed to new replies.