625 Elizabeth Drive
Ocoee, FL 34761
Say Hi!

Some WordPress code you will need during development

As a web designer, sometimes I face problem while I am working with WordPress theme development. I am expert with design and front-end development, but I am not expert with programming or coding, therefore I cannot remember all necessary code of WordPress and also not able to write the code myself.

Therefore, I am creating a list of WordPress code what I need to develop WordPress theme. This list of code will save my development time also. Let’s check my list below:

WordPress image path which relevant to the WordPress theme

WordPress image path is the most important thing which we need every time while we are developing WordPresss theme. Few designer/developer are using the full image path which is not correct. Check the correct path below:

WordPress Site URL/Wordpress Home URL

The above code for wordpress image path which relavent to the wordpress theme. But if you need to get the wordpress home/site URL then use the follwoing code:

WordPress site title for the theme

The title tag is the most important thing for a website SEO. Many developer or wordpress website owner use plugins to create the title for the website but we can generate the title very easily by using a small code and avoid the plugin. Let’s check the code for the WordPress page title below:

You can also check this post if you want to customize the title.

WordPress post and page title code

Use the following WordPress post and page title code to display your title on your website. Please note that the following code is best use for the single post.

The above code has no anchor. If you want to give the link on the title, you can use following code:

WordPress Date code
WordPress Meta code
WordPress Category code
WordPress Tag code

Creating wordpress sidebar widgets

The sidebar is a most important part for WordPress theme. We should follow the following process to create a WordPress sidebar widgets:

Register a Widget

First, you need to register the widget. Add the following PHP code in your function.php page in your theme:

Display the Widget in WordPress theme

After registering the sidebar widget by adding the above code, you need to call the following code to display the sidebar. Please note that, you have to use the following code where you want to display your widget in your theme.

Check the Widgetizing Themes page on WordPress for the details guideline of Widgets.

Menu code in WordPress

To create a menu in WordPress, generally, I use the following code. Please note that it’s for simple WordPress menu. You need to check different post for the custom, mega or dropdown menu.

Register the menu in function.php page with the following code:

Now place the following code where you want to display the menu:


No Comments

Leave a comment

All fields are required.

Modern portfolio

625 Elizabeth Drive
Ocoee, FL 34761
Powered by VLThemes
© All rights reserved.