IF you google for WordPress we will find lots of articles, even forums,… then why the hell am writing this again!!! Answer to this is i thought of sharing issues & solutions i have faced while working with wordpress ­čÖé hope someone finds it useful in their path of development.

Q.

I have migrated my WordPress application from one domain to another and My pages are not working giving me 404 error, why?

A.

Two possibilities for 404 error. One is your .htaccess file is still having your old domain or folder information, please update it and Other might be because of Permalinks, Go to sitename.com/wp-admin/ , login and Navigate to Settings->Permalinks, Verify link structure.

Q.

I have installed WordPress in sitename.com/blog directory, but i want my site to be accessed as sitename.com. how to do that?

A.

Solution is simple. Go to sitename.com/wp-admin, login and Navigate to Settings-<General. Now update

Q.

I want to update default wordpress admin username to a custom username for security reason. How to do it?

A.

This is important task to do to avoid hackers playing  with your website. This can be done only via database only because wordpress makes username filed readonly while editing. Open table wp_users table or table_prefix_users table using phpMyAdmin or any mysql tool which connects to your wordpress database.

Then use Update

Otherwise you can create a new admininstrator with your custom username, but for disabling or deleting the existing default user still you will have to do it via database,

Q.

How to remove username or name from posts in listing page?

for example,

this is my blogs first post

by Steve Jobs

this is my blogs second post by Steve Jobs

Since this is my website i dont want my name to appear for every post. how to remove this?

A.

This is common requirement faced by most wordpress users, Navigate to Appearance->Editor in admin screen. Click on entry.php, comment or remove this part,

<span><?php the_author_posts_link();/></span>

Q.

How to Integrate google analytics in wordpress with out using any plugin?

A.

Take your theme option page in Admin, which will be in Appearance->Themename Theme Options menu. Click on Integration Menu, Here an option for adding code to <body> tag is available. Copy paste the script generated from google analytics and your google analytics should be up and running now.

Q.

How to add custom taxonomy?

A.

Open functions.php file and add the below code to add our custom taxonomy.

add_action('init', 'create_movie_genre_taxonomies');
function create_movie_genre_taxonomies() {
$labels = array(
    'name' => 'Genre'
);

$args = array(
    'labels' => $labels,
    'public' => true
);

register_taxonomy('genre', 'post', $args);
}

Once we add the above code, we will find our new taxonomy in admin section under Post section as shown in below screen shot.
customtaxonomy
Also in add any new post & edit post, we will find this same genre as shown below.
customtaxonomy_addpost

Q.

How to add custom Hierarchical custom taxonomy or category like custom taxonomy?

A.

In the above code for adding custom taxonomy use ‘hierarchical’ => true attribute.

add_action('init', 'create_movie_genre_taxonomies');
function create_movie_genre_taxonomies() {
$labels = array(
    'name' => 'Genre'
);

$args = array(
    'labels' => $labels,
    'public' => true,
    'hierarchical' => true,
);

register_taxonomy('genre', 'post', $args);
}

Q.

How to create a child theme?

A.

Simplest way to inherit theme or to create a child theme from parent theme is to create a new folder yourthemename under themes folder inside your wordpress and create style.cs with the following content.
style.cs

/*
Theme Name: Your Child Name
Description: Your Child Theme Description
Author: Theme Author Name
Template: ParentThemeName
Version: 0.1
/* --------------------------------------------- */
@import url("../parentthemefolder/style.css");

@import url(“../parentthemefolder/style.css”); will inherit all the styles from parent theme so that alignment wont change and we can add our custom style sheets or styles in child theme style.cs to override previous styles.
functions.php is optional and other files like home.php,header.php,footer.php are optional and if added will override your parent file.

Be Sociable, Share!