Web Tutorial: Creating Your Own Debt Scales
Many of you have asked me how you can create your own debt scales similar to mine (see the sidebar). I used to just refer you to the site where I got edumacated myself, but that site was surprisingly scrapped by the owners. Well I guess I’ll need to write out my own tutorial.
First, though, I’ll warn you that you need to be using WordPress as your blog platform, at least with my instructions. Also, you need to be familiar with editing your site’s template. You’ll be touching your style.css and sidebar.php files (or adding a widget if you use those). I’ll give you the starter code and tell you where to place it, but you’ll need to do the final formatting yourself.
Step 1: Inserting the Stylesheet Code (Style.css)
In WordPress, the stylesheet tells the web pages how to display the html tags, including colors, font sizes and even images. Thus, it’s where you need to insert the code that tells your scale how it will look.
Assuming you know how to edit your template (e.g. via your WordPress admin panel, click Design, then Theme Editor), edit the style.css file. At the end of the file, paste the following code (the stuff in bold) and then save the file:
/* Debt Meter Start
———————————————– */
.goals {
padding: 10px;
background: #363636;
border: 1px solid #616161;
margin-bottom: 15px;
}
.goals li {
margin: 0;
padding: 0;
font-size: .9em;
list-style: none;
color: #999999;
border-bottom: 1px solid #616161;
padding: 3px 0;
}
.goals li.first, .goals li.last {
border: none;
}
.goals li strong {
color: #ffffff;
}
.graph {
position: relative; /* IE is dumb */
background: #000000;
border: 1px solid #616161;
color: #ffffff;
}
.graph .bar {
display: block;
position: relative;
background: #D94616;
text-align: left;
height: 1.5em;
line-height: 1.5em;
font-size: 1em;
border-right: 1px solid #f5f5f5;
}
.graph .bar span {
padding: 0 .5em;
color: #ffffff;
}
/* Debt Meter End
———————————————– */
Step 2: Inserting the Sidebar Code
Assuming you want this file to appear in your sidebar, you’ll then edit your sidebar file (usually sidebar.php, right-sidebar.php or something similar). If you use widgets, you’ll just create a new widget that can just present HTML code and insert the following (the stuff in bold). Note that this code does not have a header, so you’ll want to create one for yourself:
Second Mortgage Start: $77,980
<div class=”graph”><strong class=”bar” style=”width: 89.91%;”>$70,033</strong></div>
<br/>——————–<br/>
<strong>Total Non-Home Debt Start: $112,890</strong>
<div class=”graph”><strong class=”bar” style=”width: 27.22%;”>$30,727</strong></div>
<br/>
<strong>Masters Degree Tuition: $5,000</strong><br/>
<div class=”graph”><strong class=”bar” style=”width: 50.26%;”>$2,513</strong></div>
<br/>
Student Loan (Mike) Debt Start: $19,733
<div class=”graph”><strong class=”bar” style=”width: 52.68%;”>$10,396</strong></div>
<br/>
Auto Loans Debt Start: $53,032
<div class=”graph”><strong class=”bar” style=”width: 63.67%;”>$17,818</strong></div>
<br/>
Original Credit Card Debt Start: $20,000
<div class=”graph”><strong>IT’S ALL GONE!</strong>
</div>
Step 3: Modify the Sidebar Code
I’ll assume that both your name isn’t Mike, nor do you have the exact same debt amounts and types that we do, so here are some tips for editing the sidebar code:
- Compare my code with my sidebar to see where to edit the text. For example, the text”Second Mortgage Start: $77,980” appears above the first bar graph.
- Copy everything from <div> to </div> and paste if you want more bar graphs.
- To edit the length of the line, change the width percentage. 100% means the bar will be completely colored.
- The last bar graph is different because I didn’t need to display any color. You can easily just leave the width at 0% if you want.
Step 4: Modify the Stylesheet Code (Optional)
I left this step for last because I wanted you to make sure your debt scales at least displayed properly first before you try to change up the colors. Now that it does show up properly, feel free to change how it looks, but I’ll leave it up to you to figure out which code will change what. That’s the fun of HTML programming…learning some stuff for yourself 😉
Jennifer says
THANK YOU so much for this! I did a search on the internet a week or two ago and basically came up empty handed. My blog is not completely PF based, but I do write about my debt reduction attempt there, and I was looking for away to keep people posted on my progress. Other than periodically taking pictures of the paper and highlighter based chart that’s hanging on the back of my front door that is.
Clever Dude says
@Jennifer, you’re welcome. And feel free to use it to graph other things. I use it to track the number of pushups we can do for the 100 pushup challenge atBuilding Nutrition (see the left sidebar). Granted, we’ve been slacking at the pushups lately, but I’m not giving up!
Kate says
Would that work for tracking savings for a savings goal, too? Would you just substitute the word “Savings” for the word “debt” in the code?
Tyler says
I found a great widget for wordpress that does all the dirtywork for you. It was developed by a knitter to show progress on her knitting. however you could definately tune this as I have with your debt.
http://needle-exchange.ca/2007/02/05/wordpress-progress-bars-plugin-version-10/
Debt Reduction says
What a great post. Now a little guy like me can learn how to do stuff like this. You are incredible! Thanks.
Clever Dude says
@Kate, you don’t need to change the names of anything in your CSS, especially if you’re not fluent in CSS.
@Tyler, thanks for the link. I’ll check it out!
JvW says
Thank you so much for posting this! I have been trying to figure it out for a while, and I kept hitting dead ends. Last night I played and tweaked your code for about 3 hours and now I have a beautiful Debt-O-Meter! Woohoo!
Frugal Vet Tech says
Thank you! I’ve wanted to make something like this for my blog for a while now.
rafael says
I also using daily32 template how do you modified it to have 3 colum and change the colors can you help me please.
Clever Dude says
Rafael, if you’re not too experienced with editing wordpress, I can only say download some 3 column wordpress themes and compare the index.php with your own. You’ll see what you’re missing. As for the style.css file, you’ll have to reduce the size of the content and and sidebar columns and add in a whole other set of sidebar formats for the right sidebar.
I can’t give away all the secrets cause I spent literally hundreds of hours tweaking my site over almost 3 years to get to this point (different themes along the way). The only way you’ll get experienced it by trying it yourself, but I gave you a start 🙂
leo says
Thank you! I’ve wanted to make something like this for my blog for a while now.I do write about my debt reduction attempt there, and I was looking for mcdst
away to keep people posted on my progress. Other than periodically taking pictures of the paper and highlighter based chart that’s hanging on the back of my front door that is.
—————
Leo
USA