You Better Know the Basics

When you first start working with WordPress, you need to know that there are five languages you could be interacting with. You don’t need to be an expert at any of them (and in fact can want make amazing sites knowing none of them), but when you want to make a change to your theme or add a feature that no plugin exists for, it’s important to understand what each language is and how it fits in.

To start let’s take one step back and understand that WordPress is software that runs on a server and that allows users to manage content, and the content to be sent to a visitors browser.

Just had to get that little definition out there.  Now that we know that, let’s actually look at the four languages.

HTML – Hypertext Markup Language

This is the main form that the WordPress outputs the content (if we want to get specific, WordPress uses XHTML 1.0 for all it’s internal functions, but explaining that is beyond the purview of this document). HTML is a structured language that browsers can read to display a web page. Content is enclosed in tags that each have a specific meaning. Tags can (sometimes optionally and sometimes mandatory) contain a variety of attributes. An example of a tag is
[html]<a href="http://aaron.jorbin">Aaron Jorbin is cool</a>[/html]
Learning at least basic HTML is important if you want to be able to display content in a web browser. To learn more, I recommend:

CSS – Cascading Style Sheets

As the name hints, CSS is for styling a page. CSS allows you to style html elements. In WordPress, a theme’s style.css file is also the theme’s way of telling WordPress about the theme. If you open any theme’s style.css you notice that the comments at the top are structured in a key: value manner. CSS utilizes the ID’s, Classes and tags from your HTML. An example of some css is:
[css]#header ul{
width: 400px;
color: #990099;
border: 1px solid #009900;

}[/css]
This block will style all unordered lists that are inside an element with the header ID and give it a width of 400 pixels, color all the text with hex color 990099 and apply a 1 pixel solid border of the color 009900.

JS – JavaScript

Once the page is sent to a browser, if you want to make changes to how the page looks, you’re going to need to have the browser execute it. That’s where JavaScript comes in. JavaScript is primarily a client side scripting langauge. This allows it to change the way the page looks, such as by having a set of tabs that change the content of a panel or having an accordion that grows and collapses to show or hide some options. Am example of JavaScript is:
[javascript] $(document).ready(function(){
$(‘#contentheader’).click(function () {
$(‘#contentheader > h2’).toggleClass("hidden");
$(‘#contentheader &gt; h3’).toggleClass("hidden");
} );
});[/javascript]
.

PHP –PHP: Hypertext Preprocessor

This is where the bulk of WordPress is written and the bulk of where the magic happens. WordPress includes a large amount of functions that plugins and themes can use from tasks as simple as echoing a posts title to creating a custom taxonomy for posts. If you’ve ever opened up your theme’s index.php file, you’ve seen text that looks like:

[php]
<img src="<?php header_image(); ?&gt;" width="<?php echo HEADER_IMAGE_WIDTH; ?&gt;" height="<?php echo HEADER_IMAGE_HEIGHT; ?&gt;" alt="">
[/php]

The is from the header.php file from Twenty Ten and controls the display of the header images.

To learn more about PHP, I recommend the following resources:

SQL – Structured Query Language

This is the language used to speak with Relational Databases.   In WordPress, this is used to add, retrieve, update or delete a post or option.  As the name would suggest, it’s a very structured language.  You say what you want to do, to which table you want to do it and how you want it to go down.  An example of sql is:
[sql]SELECT `option_value` FROM&nbsp;`wp_options` WHERE `option_name` = ‘siteurl’ LIMIT 0,1;[/sql]
Running this query will tell you what WordPress thinks your site’s url is (if you didn’t change your table prefix).    Some more resources for understanding SQL are:

I hope these resources give you a better idea of the languages used inside WordPress.

Tweets from the week before 2010-01-25

Tweets from the week before 2010-01-18

Tweets from the week before 2010-01-11

  • @pdxcommute Thanks for the mention today. in reply to pdxcommute #
  • Today has been filled with a few moments of win, including a mention of my site on Oregon Live. For a Monday I'll take it. #
  • mmm vegetarian chili #
  • I <3 the #wordpress shortcodes api #
  • @np7776 Alomar deserves to be in. I'm shocked that Raines isn't getting the respect he deserves. in reply to np7776 #
  • Bagel time. Need to fuel some more work. #
  • @np7776 Besides Henderson, no "Leadoff Hitter" comes close to his stats. I'd love to have a .810ops/10+hr/50+ sb guy at the top of the order in reply to np7776 #
  • Just sent my Alma Mater an e-mail asking them to switch the sports rss feed to full text. #crossingfingers #
  • If you had a dream shortcode for #wordpress what would it be? #
  • @lyzadanger Those are great! Thanks! in reply to lyzadanger #
  • @Jason a regex of twitter handles that looks like "%@aaronjorbin%" ? Or just throw everyone in an array and randomize it. in reply to Jason #
  • Not going to be able to finish everything I had hoped to tonight. I'm just too tired and my productivity is low. sleep? yes, please. #
  • Let the Games Begin! Setting the scope of WordPress 3.0 in the dev chat. #wordpress-dev on freenode if you want to join in #
  • @wpmuguru I just created http://core.trac.wordpress.org/ticket/11816 . Any chance you could upload your script for switch to multisite? #
  • If your going to make me sit on hold for 30min+ at least give the option of turning OFF your annoying music & recorded messages #
  • @ctumaven mmm, marinated dinosaur. in reply to ctumaven #
  • I have put it off / But this is the weekend for / my #AMUN Debrief #haikufriday #
  • @kchrist There is nothing more important then knowing your plugins code. That's the biggest source of security holes imho #wpsec in reply to kchrist #
  • My Ballet came in the Mail. I love vote by mail. #
  • Pineapple fried rice with #pork #100meat #
  • Putting the finishing touches on my #amun09 debrief. Let me know if you want to proofread or comment on it before I submit it Monday night. #

Tweets from the week before 2010-01-04

  • @kellymariez77 mmm. I'm a bit jealous in reply to kellymariez77 #
  • Diagnosing a DNS issue #
  • I have an Amun friend in town, i think this means i'll take a productivity break for the afternoon. #
  • Horsebrass in a little bit. Not many better places to show an out of towner the greatness that is oregon beer. #
  • Some days code just seems to write itself. Today is one of those days and I'm loving it. #
  • @kchrist This barely qualifies as snow. If it sticks, you should be fine with caution and good tread on your current tires. in reply to kchrist #
  • @dtwright YES! In fact I think you should only submit in source since it's a fact that @sarahnaeger loves LaTeX in reply to dtwright #
  • @kchrist Best of luck in your upcoming hibernation. I hope your supplies last. in reply to kchrist #
  • @dtwright Not at all. Her love of LaTeX is do to the fact that it is easier to control the spread of disease (viruses) using LaTex then pdf in reply to dtwright #
  • I spent five years in a city that averaged 150 to 300 inches of snow and never saw a car with chains on the tires. 1/4 an inch in pdx? yep #
  • @Viper007Bond LA Drivers freak out when there's a cloud in the sky. in reply to Viper007Bond #
  • @_mfields Yes and I find it hilarious . I don't understand the inability to drive in snow. Take your time and plan your moves. in reply to _mfields #
  • .@trimet line 35 was stuck coming up greely = me walking 1.5 miles. It's beautiful out there. #
  • Tonight seems like perfect time to make white bean, kale and tomato soup #
  • My response to: An Exercise in WordPress Integration, or Why WordPress Sucks http://bit.ly/5OoYQg #
  • I hope everyone has a great <?php echo date( "Y" ); ?> #
  • Not happy with the start to this game. Go Ducks! #
  • It was so good yesterday, I'm going to eat some more soup and have a #bacon grilled cheese sandwich #100meat #
  • My twenty-ten goal / one hundred servings of meat / will I miss bacon? http://aaron.jorb.in/100meat/ #haikufriday #
  • Goodbye Fareless Square and Hello Free Rail Zone on @trimet. My thoughts: http://aaron.jorb.in/2010/goodbye-fareless-square/ #
  • Great story about a great guy and sled hockey: http://www.chicagotribune.com/features/chi-hockey-paralyzed-01-jan01,0,6166481,full.story #
  • @betsywhim I am sorry about your loss. I wish you lots of strength over these coming days. #
  • Sad to hear that Dennis Brutus, who fought Apartheid in South Africa and former Chicago Sun-Times Columnist Bill Gleason both passed away. #

Goodbye Fareless Square

As has been reported many other places, Today (3 January 2009) Trimet switched from the current fareless square to the fareless¬†rail zone and this is one Trimet change I’m in favor of. It has a variety of benefits and a few costs.

  • Benefits

    • Continues to provide a large area that is¬†accessible¬†during a large part of the day quickly and without a vehicle. This doesn’t mean it’s a large enough area or that it doesn’t need to expand out to include a larger part of the east side. I think the simplest way to extend it now is to go fareless¬†on the Portland Streetcar. Couple this with the expected eastside streetcar on MLK/Grand and you would have a large area that you never even need to think about driving.
    • No longer requiring bus drivers to kick people off for not having paid a fare. Every time I’ve seen a bus driver put in this situation of being forced to tell someone “pay or get off”, you can tell it’s the part of their job they hate. Now they won’t have to do that.
    • Buses will no longer need to¬†stop for fare inspectors. It’s rare, but it does happen and now these fare inspectors can¬†focus on the MAX, where there is a big fare evasion problem. I for one would really like to see fare inspectors on the MAX much more often
  • Costs

    • 5% of trips that can currently be taken for free, now can’t. According to Trimet when they announced this decision in August:

      We estimate that about 95% of the trips currently taken within Fareless Square can easily be taken on the future Green Line on the Mall, on the existing Blue/Red MAX line on Morrison and Yamhill, and on the Streetcar. Nearly every destination in Fareless Square will be served by MAX or Streetcar within 3 or 4 blocks.We estimate that about 95% of the trips currently taken within Fareless Square can easily be taken on the future Green Line on the Mall, on the existing Blue/Red MAX line on Morrison and Yamhill, and on the Streetcar. Nearly every destination in Fareless Square will be served by MAX or Streetcar within 3 or 4 blocks.

      Source: Trimet Press Release August 12, 2009

    • Service frequency for free is greatly diminished. While the Max runs frequent enough during the day, after 10pm your options for what used to be the free bus mall are extremely limited. You can get a train (at the start of the line, PSU/SW 6th & Montgomery MAX Station) at: 10:02, 10:10, 10:32, 10:40, 11:02. 11:10, 11:32, 11:40 and 12:10. That’s it. That means you can not get from PSU to old town without paying a fare after midnight on weeknights and you might be waiting 22min (which is enough to walk the entire way) for a train at other times. This just isn’t frequent enough in my opinion

Overall, I am for the change and hope that it increases fare inspection on the Max. ¬†If that happens, this will be a win for Trimet riders. ¬†Hopefully we’ll get lucky and see that happen.

Tweets from the week before 2009-12-28