Site icon WPDesigner

WordPress Tips Part 1

This post is guest blogged by Milo of 3OneSeven.com. For all codes, type them out. Do not copy and paste.

Tip #1

DO NOT use this search code in the

search.php

:

<?php echo $_SERVER ['PHP_SELF']; ?>

Nobody should be allowed to search your entire server, or?

Use this one instead:

<?php bloginfo (‘home’); ?>

Tip #2

Another bad code used in title tags or search templates:

<?php echo $s; ?>

as it allows malicious code injection.

Use this one:

<?php echo wp_specialchars($s, 1); ?>

Tip #3

Before doing any of the following customization, BACK UP your existing files. Or better, test it on your local or server test site.

Tip #4: Style Switcher The Easy Way

  1. Download this Javascript file *(Not Available)
  2. Upload the style switcher file to your theme’s “js” folder
  3. Copy your basic theme stylesheet and rename it to style2
  4. Insert the Javascript in your header:
    <script src=”<?php bloginfo(‘template_directory’); ?>/js/ style-switch.js” type=”text/javascript”></script>
  5. Insert the two stylesheets in your header:
    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_url’); ?>” type=”text/css” title=”default” media=”screen” />
    <link rel=”alternate stylesheet” type=”text/css” media=”screen” title=”style2″ href=”<?php bloginfo(‘template_directory’); ?>/style2.css” />

    Note the difference between the title “default” for your basic stylesheet and the second title “style2″. Vary your basic stylesheet by applying new rules to the id’s and classes.

  6. Upload new images to your themes image folder (if needed)
  7. Insert the script call at an appropriate place:
    Styles:
    <a rel=”no follow” title=”Toggle stylesheets” href=”javascript : chooseStyle(‘none’, % 20 60)”>#000</a>

    |

    <a rel=”no follow” title=”Toggle stylesheets” href=”javascript : chooseStyle(‘style2′, % 20 60)”>#fff</a>

    Bullet proof for IE6+7.

Tips #5

Block search robots from your archive page by preventing the indexing:

<?php if(is_archive()) { ?><meta name=”robots” content=”noindex”><?php } ?>

Paste it anywhere in the header of your current theme BEFORE the closing of the head tag.

From Small Potato

Part 2 of Milo’s tips will show you how to add Gravatar, add a side blog, customize the read more link, customize the comment link, and customize the WordPress login.

Exit mobile version