DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Create a WordPress Theme with NetBeans PHP IDE

Create a WordPress Theme with NetBeans PHP IDE

Toni Epple user avatar by
Toni Epple
·
Sep. 16, 08 · Java Zone · News
Like (0)
Save
Tweet
30.45K Views

Join the DZone community and get the full member experience.

Join For Free

I went through the WordPress tutorial for NetBeans 6.5 and it worked like a charm. My blog is also running on WordPress, and I wanted to give it a new theme for a long time. So why not use NetBeans to do this?

Here’s my old blog layout:

In this first of two articles I’ll show you how to create the basic structure for your theme. In the second posting we’ll add the dynamic content. We’ll use a ready made xhtml/css template and adjust the paths, so it can be used in wordpress. To get started, all you need is a index.html + style.css, like you find them here:

http://www.free-css-templates.com/

I’ve used this one:

http://www.free-css-templates.com/preview/spiderCity/

Download the theme and unzip it in your wordpress project’s “Source Files/wp-content/themes” folder. Wordpress will look for a screenshot.png for the theme selection in the admin backend. You can use the one above and add it to the spicerCity folder, your project should look like this:

Now rename index.html to index.php. That’s tricky, because NetBeans won’t let you change the .html extension. You can do it via the filesystem ( or you can create a new php file via New File > PHP > PHP File, name it index.php, copy the content of index.html to it and delete index.html afterwards ).

Time for a first test. Right click the project node and select “Run”. Go to the admin panel ( should be something like http://localhost/wordpress/wp-admin/), login and switch to design > themes. Your new theme will be shown. Activate it by clicking on it:

If you check out the frontend you’ll be disappointed, because style.css is not used. That’s because relative links don’t work here. To make the style.css available you need to replace the link to it in the head section:

<link rel=”stylesheet” type=”text/css” href=”style.css” />

with this:

<link rel=”stylesheet” href=”<?php bloginfo(’stylesheet_url’); ?>” type=”text/css” media=”screen” />

Now run your project again.

That’s better, but the images are still missing. You need to change every reference to the images folder following this scheme:

<img src=”images/image.gif” >

To:

<img src=”<?php bloginfo(’stylesheet_directory’); ?>/images/image.gif” >

Run your project again. This time the images should show up. ( For some weird reason they didn’t show up in my case, since they weren’t copied to the server. It only worked after I deleted all gif files from the images folder, added them again and re-ran the project. ).

Now the style is ok, and we’re done for now. In my next post I’ll show you how to put the different sections of the index.php file in separate files and drop in some more php tags to add dynamic content.

PHP WordPress Integrated development environment NetBeans

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Instancio: Random Test Data Generator for Java (Part 1)
  • Toying With Kotlin’s Context Receivers
  • How BDD Works Well With EDA
  • How to Hash, Salt, and Verify Passwords in NodeJS, Python, Golang, and Java

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo