Skip to content

Category: Wordpress

How to style wordpress default comment form for TwentyTen?

Go to your theme open comments.php if you have one:

and find the line:

comment_form();

Replace it with this code which you could change as you like:

$commenter = wp_get_current_commenter();

$fields =  array(
 'author' => '<p>' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /><label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'email'  => '<p><input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span>*</span>' : '' ) .
 '</p>',
 'url'    => '<p><input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /><label for="url">' . __( 'Website' ) . '</label>' .
 '</p>',
);

$defaults = array(
 'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
);

comment_form($defaults);

For more information check the wordpress docs: http://codex.wordpress.org/Template_Tags/comment_form

How wordpress more link can navigate to top of the full article window?

By default, when you click on the Read More link, the web page loads and then “jumps” to the spot where the <–more–> tag is set in the post. If you do not want that “jump”, you can use this code in your theme’s functions.php:

function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');

Function to get wordpress theme URL

This function will return the theme directory URL so you can use it in other functions:

get_bloginfo('template_directory');

Alternatively, this function will echo the theme directory URL to the browser:

bloginfo('template_directory');

So an example for an image in the themes images/headers folder would be:

<img src="<?php bloginfo('template_directory'); ?>/images/headers/image.jpg" />

How to rename the home link on the main wordpress menu to something else?

If you are using thematic child theme go to thematic-functions.php file in your child theme and add this:

//    Add a Home link to your menu
function childtheme_menu_args($args) {
$args = array(
'show_home' => 'Home',  //here change Home to whatever you like
'sort_column' => 'menu_order',
'menu_class' => 'menu',
'echo' => true
);
return $args;
}
add_filter('wp_page_menu_args','childtheme_menu_args');

How to move a wordpress blog site to another location?

Easy answer for most installations:

  • If database and URL remains the same, you can move by just copying your files and database.
  • If database name or user changes, edit wp-config.php to have the correct values.
  • If you want to test before you switch, you must temporarily change “siteurl” and “home” in the database table “wp_options” (through phpMyAdmin or similar).
    If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.

More info