navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

Dreamweaver and WordPress: Core Concepts
John Hersey

Dreamweaver and WordPress: Core Concepts

with Joseph Lowery

 


In this course, author Joseph Lowery shows how to combine the utility of WordPress and the power of Adobe Dreamweaver to transition existing websites to the WordPress platform. The course demonstrates how to create new blog posts and pages, customize WordPress themes, and extend WordPress editable pages from within Dreamweaver. It also covers how to add Spry elements, add and customize plugins, and enhance WordPress-stored content with Dreamweaver's dynamic pages. Plus, a chapter on responsive design shows how you can adapt your layouts for tablets and mobile devices.
Topics include:
  • Using the Dynamically-Related Files feature in Dreamweaver to design WordPress pages
  • Applying WordPress themes
  • Customizing themes
  • Adding Spry widgets
  • Adding WordPress dynamic data
  • Populating the WordPress database
  • Publishing a WordPress site

show more

author
Joseph Lowery
subject
Web, CMS, Blogs, Web Design
software
Dreamweaver CS5, CS5.5, CS6, WordPress 3.x
level
Intermediate
duration
5h 44m
released
May 27, 2010
updated
Oct 23, 2012

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:03Hi, I'm Joe Lowery. Welcome to Dreamweaver and WordPress: Core Concepts.
00:08In this course, I'll demonstrate how to set up WordPress locally and integrate it into a
00:14Dreamweaver site for more efficient development,
00:17as well as the basics of working in WordPress, Adding and Editing Blogposts, Creating New
00:23Site Pages, Inserting Images, and other Media.
00:27I'll also show you how to convert the default WordPress theme into a custom Dreamweaver
00:32design layout that fits perfectly in a full-featured site.
00:36We'll dive deeper into the Dreamweaver WordPress workflow and create responsive pages for tablets and phone layouts.
00:43In addition, I'll show you how to publish your Dreamweaver work online to make sure
00:48you've got the final results up and running.
00:50I hope you are as jazzed as I am to start exploring this exciting workflow between WordPress
00:55and Dreamweaver. Let's get started.
Collapse this transcript
Using the exercise files
00:00If you're a Premium Member of the lynda.com online training library, you have access to
00:05the exercise files used throughout this title.
00:08Naturally, the information in this course is ultimately intended to be applied to your own web pages.
00:14However, you may find it helpful to work with the supplied exercise files to practice the
00:18steps safely and without creating your own examples.
00:23You can either follow the whole course, chapter by chapter, or you can jump in at any point.
00:28All the assets you'll need for a particular lesson are found in the Chapter folders.
00:33To begin using the files from the site, download them, extract them, and then store those files
00:39in a convenient location, such as your Desktop, as I have here.
00:45The Exercise Files folder is organized by Chapter and every Chapter is broken down into
00:50the various lessons that you'll see.
00:53Within the lessons chapter there are a series of files, typically assets like CSS style-sheets,
01:00images, and sometimes PHP code, as in this lesson.
01:05In many lessons, you'll also find a final folder, and that contains the CSS and PHP
01:10and other files that show the completed lesson, which you can open up and explore at your leisure.
01:16Because we're working with WordPress, which stores much of its information in a database,
01:20it's best to follow the course chapter by chapter in order to give the most up to date database.
01:25However, if you need to jump in at a certain point, I've provided an XML file for most
01:31chapters, which you can use to bring the data into WordPress' database table with the WordPress
01:36import feature, found in the WordPress Dashboard, under the Tools category.
01:41You'll find this XML file in the Jumpin folder.
01:44If you're a Monthly subscriber or Annual subscriber to lynda.com, you don't have access to the
01:49exercise files, but you can definitely follow along with your own assets.
Collapse this transcript
A word about updates
00:00The web is constantly evolving and WordPress and Dreamweaver are no different.
00:05Before we get started, I wanted to take a moment to explain how updates to these programs are
00:09handled in terms of this course.
00:11WordPress issues minor updates on a regular basis, not too long ago they published a major
00:17release 3.4, which was followed up with a couple of minor version updates, 3.4.1 and 3.4.2.
00:26These so-called dot releases are mostly bug fixes and security refinements.
00:32The course materials should be fine with all of these program updates.
00:36However, if the course is affected by any release, we will first put out an FAQ that
00:41details the issues and any workarounds.
00:44If the issue is significant enough, I'll update the videos.
00:47Changes also come to Dreamweaver, it's less likely that Dreamweaver will issue major updates
00:53on a regular basis like WordPress does, although, with the addition of the creative cloud, that
00:58remains to be seen.
01:00However, if they do release any significant enhancements, I'll cover those first through
01:04the FAQ, and then if need be, update the videos.
01:09Bottom line, don't worry, we've got you covered no matter how WordPress and Dreamweaver are updated.
Collapse this transcript
1. Setting Up WordPress
Overview
00:00Before you can start integrating WordPress and Dreamweaver, you'll need to make sure
00:04that you have the proper development environment, as well as the most current files.
00:09There are four main components for developing with WordPress.
00:12A Local Web Server, a PHP Server, a MySQL Server, and the WordPress PHP files.
00:18Luckily, the first three can easily be installed in one fell swoop, on either the Mac or the PC.
00:25On the Mac, you can use MAMP, which stands for Mac, Apache, MySQL, and PHP.
00:31Apache is a powerful open source web server.
00:34MySQL is the database server and PHP is the server-side language, which Dreamweaver calls a server model.
00:43PC users can use WampServer, which installs of the same components on the PC side.
00:49The final component is WordPress itself.
00:52WordPress is essentially a PHP application that stores data in a MySQL database.
00:58Like the others, WordPress is open-source and freely available.
01:03Unlike the others, WordPress is a set of files and not a server.
01:07So you'll just need to uncompress these files and put them in the proper place prior to
01:11running the installation, which sets up the connection to the MySQL database.
01:16Once all these pieces are in place, we can integrate it into Dreamweaver.
01:20If you need to set up a local development environment, I strongly suggest you check out David Gassner's
01:25excellent free course right here in the lynda.com online training library.
01:31It's called Installing Apache, MySQL, and PHP, and it includes a terrific overview as well
01:37as very specific steps for handling the installations.
01:41If you already have a development environment in place, go on to creating the database in
01:45this chapter, where you'll see, how to establish the necessary database for WordPress.
Collapse this transcript
Creating the database and the initial site
00:00So, now you're ready to create the database for WordPress and set up the general site.
00:05Creating a database is a snap with phpMyAdmin, a component of both MAMP and WAMP server.
00:11So, let's open up phpMyAdmin--because I'm on a Mac
00:15I'm using MAMP--and let me bring that window to the front, and then click Open start page.
00:22If you're using WampServer on Windows, you'll need to go to the system tray, left click
00:27on the WampServer icon, and then choose phpMyAdmin from there.
00:32In either case, you'll be able to access phpMyAdmin right from your default browser.
00:38With MAMP we have a number of options.
00:39So, to get to phpMyAdmin, I'll just click it from the tab navigation up top.
00:45You could also just put in localhost/MAMP and get the same start page here.
00:50So, now we need to create a new database.
00:53If you're using an older version of phpMyAdmin, you'll go directly to the database page.
00:59With newer versions, you'll need to click on the Database's tab first.
01:04So, click into the Create database field, and enter in the name of the database.
01:09For us, it's going to be roux_blog.
01:13Now, press Tab to lock that in and then click Create.
01:18You'll get a message that the database roux_blog has been created.
01:22There's no need for us to create any tables at this point.
01:26WordPress is going to put in all the tables we need during the installation process.
01:30I do want to point out that if you're following along with the exercise files, then make sure
01:34that you use the same name that I used here, roux_blog.
01:39If you don't do that, the exercise files won't work properly.
01:42Now, if you already had a site developed and stored in a different folder, you bring that
01:47into your local web server root folder, and that's exactly what we're going to do with
01:51our exercise files. I'll hide my browser as well as MAMP.
01:56And then let's open up exercise files, and go into Chapter 1/01_02, and there you'll
02:04see a folder called roux_academy.
02:07This has all of the files for the standard website we're going to be working with except
02:11the WordPress files.
02:12So, let's copy that, and I'll copy it by right clicking on it and then choosing Copy roux_academy.
02:19Now the eventual goal is to put our WordPress files in the local site and whatever folder
02:24is used by the Web Server as the localhost root. So, we're going to set up those site files first.
02:30Now, your localhost root is different for Mac and Windows.
02:35With MAMP on the Mac, that will be in the Applications folder, and then we drill down
02:40to MAMP, and there you'll see the htdocs folder. That's the localhost root folder for MAMP.
02:50On Windows under WAMPServer, you'd find that on your C-Drive under WAMP/www. All right.
02:57I have my localsite root folder selected, htdocs, and let's go ahead and Paste in our copied folder.
03:05Now let's try that out in the browser.
03:07I'll open up a new tab, and I'm just going to enter in the full URL just so you see everything,
03:15http://localhost/roux_academy/.
03:24Now, in most modern browsers you don't have to enter in the http://, you can just put
03:29in localhost, but just so you see the entire thing.
03:31And then we'll hit Return, and there's our website, running under the local web Server MAMP.
03:38Now that we have our database created and our basic site set up, everything is prepped
03:42to integrate the WordPress files.
Collapse this transcript
Configuring WordPress
00:00Okay, our database is created, the basic site has been placed in the local Web Server root,
00:06and we're ready to move on to the next step where we finally get to install WordPress.
00:10So, you want to get the latest version.
00:12So let's go to wordpress.org--not wordpress.com, .org-- and then click the orange download WordPress
00:19link you see over here on the right.
00:22That will take you to the Download page where you can click Download WordPress and whatever
00:27the version number is.
00:29As you can see, currently we're on version 3.4.2.
00:32Now, it's entirely possible that WordPress will have released a minor bug fix version
00:38by the time you take this course.
00:39Don't worry though, the techniques I'm demonstrating will work fine with any sort of minor upgrade
00:44for security and other bug fixes.
00:47Now, I've already downloaded the WordPress .zip file and uncompressed it.
00:53And now, I have it stored on my Desktop.
00:55Now, I'm going to copy this entire folder of files, there's quite a few, about 835 in this particular version.
01:04So I'm going to right-click, and then choose Copy WordPress.
01:08You could also of course select it and choose Ctrl+C for Copy.
01:11Now, I want to navigate to my local Web Server root, and for that I'm going to go to File >
01:17New Finder Window, drill down into the Applications, locate the MAMP folder, and then I'm going
01:27to be working with the htdocs folder.
01:29And because I'm going to be working with it quite a bit, let me pull it over into Favorites here.
01:36And then I want to go into the roux_academy folder, and I want to paste that WordPress
01:41folder right in there.
01:43So, again I'm just going to right-click, and choose Paste Item, and there is my wordpress folder.
01:49Now, I tend to like to obfuscate the technology a little bit, and instead of using WordPress,
01:55which is going to appear in your path to the files.
01:58I'm going to change wordpress to blog, which is basically how we're using it.
02:04So I'm going to click it twice and then enter in the new name and hit Return or Enter.
02:10And now we're ready to complete the installation.
02:12So for that we need to go back to the Browser, and I'm going to open up a new tab.
02:18Go to my local web Server, which is localhost/, and we want to put in the name of the website
02:26that we are working with, and that is roux_academy/.
02:32To get to the installation we actually have to drill into the wordpress folder, which you'll
02:36recall we renamed blog, so blog, and now we want to go into the admin section of WordPress
02:43which is found in the folder wp-admin, and the exact file we are looking for is install.php.
02:51So, I'll hit Return.
02:54Now, you'll get a message that says it can't find the wp-config file, that's fine.
03:00That's exactly what we expected, so we want it to create one.
03:03I'll go ahead and click the Create a Configuration File button, and we'll get a brief welcome
03:08message from WordPress, informing us that it needs some more information about the database to continue.
03:13Now, we actually have all that information. So I'm going to go ahead and click Let's go.
03:19And we'll enter in our Database Name which you'll recall was roux_blog.
03:26The MySQL username which on a default MAMP installation is root, which is also the password.
03:35Keep Database Host and Table Prefix both at their default settings and click Submit, and
03:41there's that fabulous response, All right sparky.
03:44So now since WordPress can communicate with the database, we'll go ahead and click Run
03:48the install, and we need a little bit more information, the site title, which is Roux Academy.
03:58Let's keep the admin username for our administrator, and I'll enter in a password, and repeat it
04:07to make sure I got it in right. Put in my E-mail address.
04:14Let's keep the Privacy option selected and choose Install WordPress.
04:19Now, I'm going to have Google Chrome go ahead and save my password, so I won't have to keep
04:23re-entering it, and we're ready to log in. I'll click the Log In button.
04:28And since it has remembered the password we're good to go.
04:31So, here's the official log in page.
04:33I'll click Log In, and there is the WordPress Dashboard, including a bright and shiny new
04:39welcome screen with lots of information on it.
04:41If you're just starting out, there is lots of great links here for you to follow.
04:45But since I'm going to be guiding you here let's go ahead and click Dismiss.
04:49And that will take you to the actual Dashboard page.
04:52We're going to spend a good amount of time exploring, and even modifying the dashboard
04:56in the remainder of this course, but for now let's partake of a little immediate gratification
05:01by taking a look at the current site.
05:03Go over to the upper left and click on the title name for your site, and your site will
05:08open up in the Browser Window with some sample content.
05:11So this is the site with the blog title that we entered earlier, Roux Academy.
05:16The subtitle, Just another WordPress site, is one of the default entries that we can clear out later.
05:22Of this particular WordPress theme--it's the default one that's called 2011--uses a random
05:28background picture.
05:29So you may have a different one than the one that is shown on my screen.
05:33Let's go ahead and click Refresh, and you can see another image popup each time, always
05:37have guaranteed one.
05:39So, everything that you see here is the default setup, which we will customize and change
05:45throughout this course.
05:47Now that you have all the essential elements of WordPress setup, you're ready to move on
05:51to integrating Dreamweaver into the workflow.
Collapse this transcript
Establishing a Dreamweaver site
00:00To make sure your WordPress Dreamweaver workflow is smooth you'll need to set up your Dreamweaver
00:05site with the appropriate testing server.
00:08Dreamweaver's New Site dialog box makes it very straightforward.
00:11So, there are a couple of ways you can open the Site Setup dialog box.
00:15You can either go to the Site menu up here and choose New Site, or if you have the Welcome
00:22Screen open like I do, choose Dreamweaver Site under the Create New column.
00:27Now, if you're just setting up a standard HTML site, all you would need to do is to
00:32enter the two values on this initial screen. We'll have to do a bit more.
00:36But let's start there by naming our site. I'm going to call this one Roux Academy.
00:44Of course, that's just a name that's going to appear within Dreamweaver.
00:47So you do want to name it something that's easy to recognize.
00:50So now we're going to choose the Local Site Folder.
00:52I'll click the Folder icon.
00:55Then browse to my htdocs folder which is the local site root, and select the roux_academy folder.
01:00Now, be careful that you don't want to choose blog because we want to get the entire site,
01:05not just the blog portion of it.
01:07So, I click Choose, and there is the path to our local site root folder.
01:12Now that I have that identified, all I need to do is to add a testing server.
01:16So, I'll click on servers in the left column. You can add as many servers as you like.
01:21To define a server, click on the Add button.
01:24We'll start the process by entering in a Server Name in the top field.
01:29We'll call this Testing.
01:32We want to connect using, not FTP, but Local/Network.
01:36That will change what you see on the screen.
01:40All we have to do now is select the Server Folder.
01:44That's going to be the exact same folder we've been working with.
01:46So again, I'll go to htdocs > roux_academy, and click Choose.
01:52Now, I want to enter in my local web URL.
01:56So, I'll put in after the http://localhost/roux_academy.
02:06You can put in the trailing slash or not.
02:08If you don't, Dreamweaver will put it in for you. Let's switch over to the Advanced Tab.
02:12I'm going to choose my Server Model from the list here down at the bottom.
02:17I'm going to select PHP MySQL of course, and click Save.
02:21There you see our server listed in the Server panel.
02:25Dreamweaver has a tendency to always assume that the first server defined is a Remote server.
02:30We want to switch that to Testing.
02:32So, clear the check box under the Remote column, and click the check box under Testing.
02:38If you don't do this, Dreamweaver will not recognize the server when you try to access
02:42it during live view. Let's click Save.
02:47Once Dreamweaver updates the site cache, we can see all of our files in the Files panel
02:52over on the right, including the blog folder.
02:56Let's go ahead and open up that blog folder, and I will expand the listings here so we
03:00can see the various names.
03:02Then I'm going to double-click on index.php, the very first file listed here.
03:08Let me go ahead and go into Split view.
03:11You may be a little surprised if this is the first time you've ever seen a dynamically
03:14related file, to notice that Design view is completely blank.
03:19And what's more over in Code view there's very little code.
03:24That's because of the way that WordPress constructs its pages dynamically.
03:28So, let's take a look at how this page might actually look in the browser by switching to Live view.
03:36I'll go to design.
03:38Here's the same page that we saw in the browser with yet a different image.
03:42Let me go ahead and click Refresh to see how that random header image functionality is
03:45still working, and it is. There's the rest of our page.
03:49So, it's the exact same page that we see in the browser.
03:52Now, your WordPress site is set up within Dreamweaver, and it's ready to be customized.
Collapse this transcript
2. Exploring a WordPress Site in Dreamweaver
Accessing dynamically related files
00:00One of the key features for working with CMS systems like WordPress is known as dynamically-related files.
00:07The related files feature, which was introduced in Dreamweaver CS4, made directly linked files
00:12like CSS, JavaScript, and PHP just one click away.
00:17Now with dynamically-related files you can access nested PHP files just as easily.
00:24For example, let's open up the index.php file from the blog root, and here I am in Design
00:31view because we were last working in the Designer workspace, and you'll notice that, as before, the page is blank.
00:37So I'm going to switch over to Split view and then broaden the code window a little
00:43bit, and you'll see that this is comprised of a fair number of PHP comments right up
00:49front, as well as two other little code snippets.
00:52The first one defines a variable as true and the second one requires one file.
00:58And you can see up here in the related files toolbar I do have that file included wp-blog-header.php,
01:06and if I click to that--let me lower the Properties Inspector here so you can see a bit more code.
01:12There's not a whole lot of code to see.
01:14It's just a kind of switch statement that allows WordPress to load in one file or another.
01:19Without the dynamically-related files feature this is as far as you could go.
01:23The way that WordPress works is that it will continue down this path of bringing in nested
01:29PHP files one after the other.
01:31As you'll soon see there are over 70 different files related to just this one page.
01:36Now we can expose all of those files and get access to them through the dynamically-related files feature.
01:43Up here in the Info bar you'll see a message that says this page may have dynamically-related
01:48files that can only be discovered by the server, and a couple of link options, Discover and Preferences.
01:54In Preferences, you can set the options so that this happens automatically.
01:58I tend to like it so that you have to do it manually each time because then if I'm not
02:03interested in seeing the additional files I don't have to worry about them, but where
02:07the real magic is is by clicking on Discover, which I'll do right now.
02:12Now you'll get a script warning from Dreamweaver saying that it was going to run this through
02:16the server, and if you want to proceed click Yes.
02:19Well, we definitely do, so let's click Yes, and you can see in the Related Files Toolbar
02:25that stretches across the top of the page that there's a whole range of files which
02:29have been dynamically discovered.
02:31In fact, there is so many that they have extended off the page.
02:36I can click the Scroll button here and the files will scroll across, and I can also go back if I need to.
02:43Sometimes this is handy for locating a specific file, but in this case, there's an awful lot
02:48of files, and you can see them all, well as many as will fit on the screen by clicking
02:53the Show More option here in the right-hand side of the document window.
02:58And there you see the first group of files.
03:00I'll go down and hover over the Scroll button so we can go all the way down to the bottom of them.
03:05As you can see, there are just an amazing number of files that are interconnected here.
03:09WordPress, as I said, uses about 70 different files in its default page, all of which are
03:14available to you in Dreamweaver.
03:17You can access them directly just by clicking on any of the files here, and they'll show
03:21up right in Code view.
03:23Let's go to media.php, and here's the WordPress API for Media display.
03:30If you want to dive in for a closer feel, feel free to click on Code view to expand
03:35the page and then start to look for various PHP functions that you could find on the page.
03:39I'll just scroll down a little bit and the first function that we see here constrains
03:43the image size for the editor. There are many other types of pages as well.
03:47There is CSS, scroll back to the very top of the file we should see a CSS one close
03:52to the start, and here's our CSS page.
03:58And there are also XML files, all of them are immediately accessible through dynamically-related files.
04:03So now that you know how to access some of the deeply linked files used in WordPress,
04:08you'll be able to customize your site easier than ever.
Collapse this transcript
Filtering files
00:00In some ways the dynamically-related files feature is too good.
00:05Once you've loaded a primary WordPress page into Dreamweaver, like this one picked up from
00:09the previous lesson, you'll get links to an overwhelming number of files.
00:14The Related Files Filter can help you narrow those down to just the ones you want.
00:20So now we have, as I said before, a little over 70 different files. Let me show you how to
00:24hone in on just the ones you want.
00:27This icon over on the top-right opens up the Filter Related Files dropdown where initially
00:35you can see All Files Type.
00:37Now there are three different file types that are included here, CSS, PHP, and XML.
00:44This list is populated dynamically depending on what the initial PHP file is related to.
00:50Not all will have XML files, for example, so we can disable that XML option if we like,
00:57as I deselect the XML option it disappears.
01:03Of course the file is not trashed, it's just hidden from view, and you can narrow the displayed
01:08files even further.
01:10You of course have access to all the other PHP files like the wp-blog-header.php file.
01:17Let's say that you want to narrow the displayed files even further, and that you're only really
01:22interested in the CSS file.
01:24So I'll go back to my filter and deselect the PHP file type, and we're left with just
01:32the one PHP file that I currently have opened and style.css.
01:37You may be wondering why didn't the PHP file, that we're looking at disappear as well?
01:42Well, that's because we have it open, and Dreamweaver wants to be sure that you're finished working with it.
01:47So to make it go away all you need to do is select the style.css file.
01:53Let's go back, and I'm going to show all the file types again, by choosing the top option
01:57in the filter Show All File Types.
02:00Now they're all back, because I want to show you another way to filter your files.
02:04Sometimes what you're looking for cannot be easily divided by file extension, you might
02:09be looking for a specific file. For this we go to the Custom Filter option.
02:15Let's open up the Filter dropdown one more time, and the last option on the list is Custom Filter.
02:21So I'll select that, and a new dialog box opens up.
02:25Let's say we're looking for a file called header.php--that I happened to know the file
02:29name of--so I can type that directly into the field here and then click on OK.
02:36And again, because I'm on the style.css file that remains but here's my header.php file,
02:41and all the other files are gone, and once I select that style.css goes away.
02:47Now if I wanted to work with a series of files, I can easily do that through the Custom Filter option as well.
02:52Let's reopen it, again go to the Filter icon, choose Custom Filter, and right after header.php
03:00I'm going to put in a Semicolon and enter in style.css.
03:07I'll click OK, and there's our two files.
03:10And this time when I click on style.css it shows up, and if I switch back to header,
03:17style.css is still available to me.
03:19The Custom Filter option also allows you to use wildcards.
03:23So let's say I want to look for a file called footer, but I'm not sure if it's footer.php
03:29or wp-footer or some other file name. So I'm going to reopen Custom Filter again.
03:37Add another Semicolon after style.css, and this time I'm going to put in Asterisk
03:43which is the wildcard, footer, and then follow that with another Asterisk so that
03:49will get any file that has footer in its name.
03:52I'll click on that and here we see a couple of footer files have shown up footer.php and
03:59sidebar-footer.php.
04:02And now when you're ready to go back to seeing all the file types just simply click on the
04:08Filter icon one last time and choose Show All File Types.
04:12Now that you know how to filter through the related files, it makes using these dynamically-related
04:17files as a whole lot easier, doesn't it?
Collapse this transcript
Following links
00:00Live view is great for checking the page or working on it in Dreamweaver to make sure
00:04that your CSS and other aspects are just the way you want them.
00:08But wouldn't it would be great if you could verify that the links to other pages in your
00:12site, or away from your site even, work as well?
00:15Well, you actually can, by working with the Follow Links feature.
00:19Let me show you how it works.
00:21So here we are in Live view that will open up our blog page, and there's just a few links
00:26down below, if I scroll down that we can access.
00:31Now normally in Dreamweaver if I go up to a link, and I'm in Live view, you can see
00:36where I hover it, and you can see the underline up here as well as the pointer turn into a
00:42hand, indicating that it's a link. However, if I click on it nothing happens.
00:48Oh, well that's not quite true.
00:50Clicking on it does allow me to inspect the current styles over here in the CSS Styles panel.
00:57Now say I wanted to see how this linked page look in comparison to the Homepage.
01:02Notice the Location field that you see up here in the Toolbar available to us now that
01:08we're in Live view.
01:10As you can see, it goes through the URL address that we set up earlier and pointing to our
01:15blog, starting with a localhost, our web server, the Roux Academy, the folder, and blog our WordPress folder.
01:23Now because we're looking at this blog page I can use this address bar to go to any other
01:29page within the site directly.
01:31So if I wanted to go to the homepage of the site I can get rid of the blog folder and
01:36type in index.htm, and hit Return or Enter, and there is the homepage for the site.
01:43This is the site that we're going to be converting the blog to.
01:47Now if I want to go back to where I was to the initial page that open I can click on
01:51the homepage icon and the URL changes in the address field. In this situation, the Home
01:59icon will take you to the page that you originally opened in Dreamweaver.
02:03If you want to follow a link, you have two options, and those can be found here in the
02:08Live view options list.
02:11The first option Follow Link (Command-click Link) is the default.
02:19On the PC you will see Ctrl-click Link, so let me demonstrate that by going down, and
02:24I'll hover over this Comment link, which says 1 Reply.
02:28This time, although you can't see it, trust me on this, I'm going to press the Command
02:31key and Click, and now it goes to another blog page that has the comment that you see
02:39here, and as you can see, up in the address field, especially when the tooltip opens up,
02:46there is a unique URL there.
02:49It's not a specific page, but it is passing arguments to the PHP server.
02:53And, as you can see, scrolling up just a little bit, we have our Header area, is the same,
03:00but the content has changed.
03:01I'll return by clicking the Back button, and it works just like the browser.
03:08So now let's change that option under the Live view options so that we follow the links continuously.
03:16For this we won't have to hold down the Command or Ctrl key, so now I'll scroll down again
03:22to where the links are, and this is another trust me situation where I have my hands away
03:27from the keyboard, and I'm just going to click on the mouse on the comment one more time.
03:34And again we go directly to that link. All right.
03:38Let's head back one last time, and I want to show you another feature.
03:43Here is a link to WordPress.org and even though this is not one of the local pages on your
03:49web server, I can click on it, and we'll go to the WordPress.org site, which you could
03:54if you wanted to explore at your leisure.
03:57Now let's go back to our original page by clicking on the Home icon.
04:01This ability to follow links within Dreamweaver not only ensures that your pages are connected
04:06properly but as you'll see it will also allow you to make changes to the linked pages as
04:13you grow your WordPress site.
Collapse this transcript
Employing Live Code
00:00Once you start working with dynamic applications like WordPress, you quickly realize that
00:05the HTML in your source code is only the starting point for what the user sees.
00:10Dreamweaver's Live Code feature allows you to explore the server processed code so that
00:16you can debug your pages with the final output.
00:19To illustrate this, let's take a look at our index.php file one more time.
00:24So, here we are in Live view, and let me switch to Split view here so that we can see both
00:31the code and the page itself.
00:35The Design side over on the right renders fine, but Code view doesn't really change
00:40when we go into Split view, as it's just as minimal as it was before.
00:44However, if I go into Live Code--which you see up here listed just to the right of Live
00:51view--I'll get the entire page from the DOCTYPE declaration, which I'll scroll to all the way
00:58up top, all the way down to the closing HTML tag here at the bottom.
01:03Now, let me go ahead and go into Full Code view, so we can explore this a little bit more easily.
01:11Now you may be wondering what's the yellow background all about, and that's to indicate
01:16that the page is not editable.
01:18So, you can't make any changes in Live Code just like you can't make any changes in Live
01:24view, but you can get an awful lot of information from it.
01:28With Live Code we can actually pinpoint sections of the page that we want to work with.
01:33So, let's say that we want to work with the top section of the page.
01:38So, now I'm going to scroll down a bit, so I get to about line 23, and here you see this
01:44is where of the body tag begins.
01:47And, as you can see, here are a number of classes set up.
01:51There is home, blog, single-author, two-column, and right-sidebar.
01:57Let me go ahead and I'm going to go back into Split view, and now I'm going to go to a single
02:07page, Recent Post, and I'm going to click the link.
02:12In the previous lesson we enabled continuous link clicking, so I won't have to hold down
02:17Ctrl or Command key, and that will go to that page.
02:22And now let's take a look in Live Code view, and now on line 26 we see the body class has changed significantly.
02:30And now, there are a number of different classes that were dynamically assigned, single, single-post,
02:37postid-1, and so forth.
02:40Knowing what these classes are named can help you track down elusive CSS bugs when you're
02:45trying to fine tune your pages.
02:47Live Code can give you a real under the hood peak at your WordPress pages during runtime.
Collapse this transcript
Enabling site-specific code hinting
00:00As noted throughout the course, WordPress is at its heart a PHP application.
00:05More importantly, it is a highly evolved PHP application with hundreds of its own functions
00:11and methods built-in.
00:12Dreamweaver includes a feature that can open the door to this WordPress specific code to
00:17make it very straightforward to apply. Let me show you how to put it to work.
00:22So I have opened the index.php file from my basic WordPress set of files, and I've discovered
00:28all of the dynamically-related files shown here in Split view.
00:32Let's say that I want to add a bit of PHP code to my sidebar.php file.
00:37First, I'll use the Custom Filter to isolate that file.
00:42So I'll go over, click on the Filter icon, choose Custom Filter and then in the field
00:48in the Custom Filter dialog box enter sidebar.php, click OK, and there's my sidebar.php file.
00:59Let me go ahead and switch over to Code view.
01:04So I'm just going to place my cursor above the div that you see here, and I'll start
01:09to enter in some code.
01:11I'll start with a PHP code block, and once I do that I trigger standard code hints for
01:18PHP, and if they don't show up right away I can invoke them by pressing Ctrl+Spacebar,
01:27and there is a slew of functions, including various PHP functions.
01:32Many, but not all, WordPress functions start with the initials WP, so watch what happens
01:39when I enter those initial letters with code hints being displayed. W--so there's W--
01:45and, as you can see, there is a lot of information about various PHP information that we see
01:50here, and if I hit the p character, well there are no code hints, because WordPress functions
01:56are not part of code hints generally, the code hints toolbar disappears.
02:01Now you can however bring them in by turning on what's called site-specific code hinting,
02:08which is found under the Site menu.
02:11So I'll go up to Site and choose a Site-Specific Code Hints.
02:17Now there's an awful lot of power built into this little dialog box, but one of its best
02:22features, as far as WordPress is concerned, is how you don't have to do anything but turn it on.
02:28So let me just go ahead and click OK, and then we'll come back into that dialog box.
02:36Although it's not immediately obvious a new file has been added to the site.
02:40Let me close up the CSS Styles panel so we can expand the Files panel, so let me collapse
02:46the blog folder and here right below that folder you'll see a cloaked file, called dw_php_codehinting.config.
02:55Now this file is to be used within Dreamweaver only, and because it's cloaked it will never
03:01be sent up to your server by accident.
03:05So now that I have this file added, let's go back to my code, and this time I'll invoke
03:11the code hinting one more time by pressing Ctrl+Spacebar and type in WP, and this time
03:19we have access to hundreds of WordPress functions.
03:23So I'm going to complete this by entering a little bit more code.
03:26Let's say that I wanted to show a list of pages in the site, so I'll enter wp_list,
03:32I'll put in the P for pages there, and you can see the code hinting narrow down.
03:40And once I get to this point I can go ahead and hit Return and let code hinting do its
03:45magic and then I'll just finish off the function with a closing parenthesis, a Semicolon, and
03:52let's close off the PHP code block.
03:55So now if I go to Design view, and I'll click Refresh, and then scroll down, you'll see
04:02a list of the pages that we have here.
04:05This is the output for the code that we just put in the sidebar, wp_list_pages, it is
04:13of course unstyled and not something we want to keep so I'm going to go ahead and delete
04:18that, and we save sidebar.php.
04:20And that's just a small example of what's possible.
04:24Well, Dreamweaver is a Site-Specific Code Hints features won't teach you everything
04:29you need to know about WordPress' function, it can provide a significant leg up and one
04:34that we'll take advantage of later in this course.
Collapse this transcript
3. Creating Content
Adding blog posts
00:00In a WordPress/Dreamweaver workflow, you'll want to take advantage of the strengths of both platforms.
00:06One of the key uses of WordPress is its ease of adding content.
00:10As a web designer, it's important to understand the user experience, so you can create sample
00:15content, and control the look and feel of typical posts.
00:19Let's start by opening up exercise files for Chapter 3.
00:23Let's drill down into the 03_01 folder. Here you'll find a number of documents.
00:29If you have Microsoft Word installed, double-click the Roux Academy Art Conference.doc file.
00:36If you don't have Word, you can use the corresponding Rich Text File with the RTF extension.
00:41We have Word installed here, so I'll just double-click the .DOC file to open it up in Word.
00:46Now, in Word, I'm going to highlight the two paragraphs.
00:50I'll leave the title separate because that goes into WordPress individually, and now
00:55that they're highlighted, I'll press Command+C to copy them, Ctrl+C on the PC of course.
01:01Before we flip out of here, notice that we have two different paragraphs here, as well
01:05as some text that's formatted with bold. With that copied, let's go back over to the WordPress dashboard.
01:11Now, if you aren't logged in, open up the index page for the blog by putting in localhost/roux_academy/blog,
01:22and then scrolling down a bit until you see the login link.
01:25Let me show you where that is.
01:28Where I have Log out, you would have Log in obviously, I'm already logged in.
01:35So click that, and that will take you into your Dashboard.
01:38Let's bring in a new post.
01:40There's a number of ways that you can get to it, one of the easiest is just go to Posts
01:45and then choose All Posts, and then choose Add New from the flyout menu.
01:52And now we're ready to enter in a title, and I'll put in Roux Academy Art Conference, and
01:58once we do that and press Tab, WordPress creates what's called a Permalink or Permanent link,
02:02which you can edit if you want to, but let's leave it like this for now.
02:06Permalinks are very valuable because you can use them to link from within WordPress or
02:11from other programs or other sites.
02:13So now I'm in the Editor, and you'll notice here that there are actually two tabs, one
02:17for Visual and one for HTML.
02:19We're going to go ahead and stay in the Visual one for right now.
02:22Now I could go ahead and just paste in my content, but I want to show you a little trick.
02:27So when you first come into the Dashboard for the first time, you'll see one row of
02:32buttons in the toolbar editor.
02:34There actually is a second row which you can access by clicking this last button on the
02:39left, which is labeled Show/Hide Kitchen Sink.
02:43Now on that second row are a couple of clipboard icons, one for Plain Text and one for Pasting from Word.
02:52Let's click on the Paste from Word icon, and that will open up a dialog box, and now we're
02:58ready to paste the text that we had copied from Word into the dialog box.
03:02I'll press Command+V and then click Insert.
03:06Now, notice that it came in, and it's two paragraphs, and the text is bolded.
03:12Now one thing I want to point out is that not only does it add the formatting and all
03:16the content, but it actually converts it to HTML syntax properly.
03:20So, if I put my cursor in the seven days and seven night text here, you'll see down where
03:26the path is indicated that we go from a paragraph to a strong tag.
03:32We can verify that by going over to the HTML tab, and here you'll see the strong tag surrounding
03:39that text, as it does also at the bottom.
03:44Using strong rather than bold is the proper way to handle bolding in a web standard compliant website.
03:49Now, something else I want to point out while we're here in the HTML tab.
03:53While we have the strong tags clearly present, you'll notice that there are no P tags or
03:58paragraph tags surrounding the paragraphs.
04:01Filtering out the P tags is standard WordPress behavior, and while there are workarounds
04:06you could put in place, they can be more trouble than they're worth.
04:09In my view, you're better off just getting used to this particular WordPress style.
04:14When published, WordPress will put the P tags back in.
04:17Now, let's switch back to Visual, and we're ready to publish the text.
04:22So, I click the big blue Publish button over here on the right.
04:28And once that's published, you'll see a little note up above, Post published, and we have
04:33the option for viewing the post.
04:35So let me click that, and then I'll scroll down, and there is our title and our two paragraphs
04:43all placed into the existing theme.
04:45As you can see, WordPress makes adding new content extremely easy.
04:49It's really no wonder that WordPress is among the world's most popular content management systems.
Collapse this transcript
Editing blog posts
00:00Nobody is perfect, and almost every blog post entered needs to be modified at one point or another.
00:06Luckily, editing the WordPress post is just as easy as creating one.
00:10If you're logged in, you can actually enter into Editing mode right from the blog itself.
00:15Right up top in the Admin Bar, you'll see a link marked Edit Post.
00:20Click that, and you'll be taken back to the dashboard in Edit Post mode.
00:25The Admin Bar is a relatively recent addition to WordPress, and only shows up when you're logged in.
00:30Standard site visitors will not see it.
00:33Let's go ahead and make a few changes to the post.
00:36I'll add in a paragraph return right before in addition in the second paragraph and then
00:41I'll highlight some of the words in the post.
00:43So, let me select 500 hundred here, and rather than using bolding, let me use Italics this
00:49time, and you can see down below that the em tag is used, emphasis tag, which is the
00:56web standard method for emphasizing something that typically results in a italicized font.
01:02Of course, you can control that. Now, let's do one more.
01:05I will do the same thing for not-to-miss conference.
01:09Okay, I've made my changes.
01:12Notice that the big blue button has changed from Publish to Update.
01:16And that's because we're doing edits, and once I do that, we'll get a notice that our
01:24post was updated, and I can check that out. So I'll click on view Post, scroll down.
01:30Now, I have three paragraphs as well as some emphasized text.
01:35Okay, let's head back to the dashboard.
01:37Now, if you've just left the dashboard, you can also hit the Back button in the browser.
01:42So, that will take us back to Edit Post, and let's click Dashboard to go to the admin section home.
01:49There are several other ways that you can get to editing posts.
01:52From here, you'll see that I have 2 Posts listed.
01:55Now, if I click on post there, it will show both of my posts, and if I hover over Roux
02:01Academy Art Conference, I will have an Edit option, and then I can click that and go to Edit.
02:08Let's go back.
02:09I can also just double-click on the title, which is a nice shortcut for editing your posts.
02:14Let's go back one more time. Now, I also have a Quick Edit option.
02:19When I click on that, I don't have the body of the post available to me, but I do have
02:23pretty much everything else.
02:24I can change the title, I can change what's known as the slug.
02:28Later on, we'll work with the Categories to change those up, and I can perform various other actions.
02:35So, I'll cancel that operation.
02:38Inevitably, there are times when you want to remove posts.
02:41You can do that from the Posts screen as well as editing or quick editing by hovering over
02:45the item you want to get rid of, like I have Hello world!
02:49here, and you'll see a Trash option listed there.
02:52This is a default content, and we don't need it anymore.
02:55So I'll go ahead and trash that.
02:58Notice that WordPress does not offer you a confirm option, it will just immediately delete it.
03:03However, you do have the option to undo that action, should you so choose, which is listed
03:09up here right where the message is that it has been moved to the trash.
03:13Before long, you'll find that editing blog posts will quickly become second nature to
03:17you and your clients.
Collapse this transcript
Adding new pages
00:00Adding new pages to a blog is different from adding a new page to a standard Dreamweaver site.
00:06All of the action takes place in the WordPress Dashboard instead of the Dreamweaver Files panel.
00:12Let me show you how that works.
00:14Here in the dashboard, you'll see over on the left a Pages category.
00:17Now if I hover over the term Pages, you'll see that I have the option for editing the
00:23existing ones by clicking All Pages here or adding new ones.
00:29WordPress, by default, starts off with just one page, as you can see here in the All
00:34Pages menu, but I can add as many as I like.
00:38Let's start by clicking Add New, and the first thing is to add a title.
00:44I'm going to call this Conference Schedule At-A-Glance.
00:49When I press tab, WordPress automatically creates the Permalink.
00:54All of this information has been recorded and is being stored in the MySQL database.
00:59Now, for the initial content of this page, I've already created some text that's sitting
01:03in the Exercise Files folder.
01:05So let's head back over to Finder or Windows Explorer, open up the Exercise Files folder,
01:12and then open Chapter 3 and 03_03 is where we're at now.
01:18So again, I have both a DOC and an RTF, so you can use it whether you have Word or not.
01:24Let's double-click on DOC to open it up in Word, and then again, I'm going to go and
01:29select everything except for the title because we've already put that in, copy that with a Command+C.
01:36Now let's head back to our browser where we can paste it in.
01:41And again, I'm going to take advantage of this Paste from Word option that I have here.
01:46Once I open that up, I'll press Command+V, and it looks a little wonky in the formatting,
01:52don't worry about that, that's just this dialog box.
01:55Go ahead and click Insert. And there is all of our text.
02:00Now, let's just go ahead and publish it and see how it looks.
02:05Once it's published, I can click on view Page, and then scroll down, and there's our new page.
02:13Notice that different styles for the bullets, the filled-in squares are being applied here
02:18instead of the standard unstyled circular bullet.
02:21That's just part of the default theme styling. Well, let me head back to the Edit Page screen.
02:27And again, I just want to point out this Permalink that's automatically created.
02:31You might remember that a similar one was created for the initial blog post that we wrote.
02:37WordPress also creates one for every page.
02:40You can use this Permalink to make the connection from other pages on your site.
02:44The Page feature in WordPress is very impressive to me.
02:48The more you work with it, the more you'll come to appreciate the ability to create pages
02:52so quickly and easily, and if you're like me regard it as one of WordPress' most powerful features.
Collapse this transcript
Including images
00:00Naturally, you could include images in your blog posts.
00:04You'll need to make them available to insert, and you can do that right from the WordPress
00:08dashboard, either one at a time or in small batches.
00:12Let's start with a single image.
00:14I'm going to go back to my Pages, and then reopen Conference Schedule At-A-Glance, and
00:21let's add an image right to the top of the page, right next to the opening paragraph here.
00:27So, I'll put my cursor there, and then choose Upload/Insert, which is above the toolbar.
00:34You can also click the small icon if you want, it doesn't really matter.
00:37And then let's choose Select Files.
00:40Now we're going to navigate to our exercise files Chapter 3 in the 03_04 subfolder.
00:48And within that is another subfolder called images, and let's pick up conference_venue.jpg.
00:55There's a small preview of it.
00:57You can see it's already sized to 180x180 pixels. It looks good.
01:02But as you'll see later, that's not really an issue for WordPress.
01:05So, I'll click Open.
01:07And once I do that, you'll see the information down below.
01:12I can make some changes to it.
01:15There is of course a possibility for changing the title.
01:18So, rather than a lowercase title that has an underscore in it, let's make it uppercase,
01:25or initial uppercase anyway, and get rid of that underscore.
01:30And I'll put in some alt text. Let's call it Roux Academy Art Conference Venue.
01:40You can also add a caption and description if you like.
01:43We'll pass that for now.
01:45Now, notice down here below those two fields, there's a link to the image.
01:51WordPress, when it uploads the file, has taken it and put it within the wp-content/uploads
01:57folder, and then it creates several new folders which are named according to the year and
02:02the month that it was uploaded.
02:04Right now, when I'm recording this, it's September of 2012.
02:09So it goes into that folder.
02:11Now we can also, at this point, go ahead and choose whether we're going to align it left, center, or right.
02:16Let's go ahead and put it onto the left, and we also have the options for changing the size of it.
02:23Since full size is not that big, it's only 180x180.
02:27Let's leave it at those dimensions.
02:29Before we insert into the post, I want to show you that there are some other options that you have.
02:33So, let me scroll back up.
02:36And right under the image thumbnail is an Edit Image option.
02:39Let's click that for a moment.
02:41And, as you can see, there's a whole range of possibilities here, including cropping,
02:45rotating in one direction or another, flipping vertically, flipping horizontally.
02:50And once you do an action, you also have the ability to undo the action, so these arrows
02:54will become active then.
02:56You can also scale or crop the image if you want.
02:59Moreover, you'll notice that for large images, there are thumbnails that are automatically created.
03:05These are brought into play for very large images, and you can either apply the changes
03:09that you've just specified to both of the full-size images, and the thumbnails, a thumbnail
03:13by itself, or everything but the thumbnail. Okay.
03:17It looks like we're ready to go.
03:19Let's go ahead and cancel the Edit options, and then I'll scroll back down, and choose Insert into Post.
03:29And because we chose Aligned Left, if I select it here, you can see down below in the little
03:35tag selector like bar, there is my image tag with a class of alignleft applied to it, as
03:41well as several other classes.
03:43Let's go ahead and update the page, and then take a look at it in the browser.
03:50So, that's working with images one at a time.
03:53But what happens if you want to make a series of images available for your client?
03:58You can upload several images at a time to what's known as the media library without
04:03putting them into any posts.
04:05Let's head back to the Edit Page screen, and this time, I'll click the Media icon.
04:12If I click it here, the Select Files dialog will allow me to choose more than one file at a time.
04:19So, I can select the first one, and then hold down the Shift key, and select the other two.
04:25Now, we have all three selected, I'll click Open, and it quickly imports them all.
04:33To make any modifications, you click the associated Show link that you see here.
04:38So, let's do that for the first one here, artwork1, and that will open it up to the
04:43screen that we saw before.
04:46I'm going to change the title of it here from the generic artwork1 to something more specific.
04:51So, let's call this Self-Portrait by J. Jerome.
04:58Now, instead of inserting the image into a post, I'm just going to scroll down and click Save all changes.
05:09So that will now show me what images are in my media library so far.
05:13And here you can see the four that I've added to the library, the one that I renamed which
05:18was from artwork1 to Self-Portrait by J. Jerome, artwork2, and artwork3.
05:24Now, let me show you how to add an image from your media library into the post.
05:28So, I'll close the Add Media dialog box, go back to my post, and I'm going to put my cursor
05:36right between the two days that we have here. So again, I'll go and click the media icon here.
05:43Now, instead of choosing Select Files again which will allow me to upload files, let's
05:49go to Media Library, and then I'll choose Show right next to the Self-Portrait.
05:55Again, you've got the possibility for making all kinds of updates to title, caption, et cetera.
06:00So, let's go ahead and add a caption here, so you can see how that works.
06:03I'm going to copy the title, and then paste it in the Caption field, and let's add a date in parentheses.
06:11Now, I want this image to be centered and not left, so I'll choose that alignment option,
06:16and let's scroll down and see about our sizing.
06:19Again, I still think it's still okay size-wise, and now we're ready to choose Insert into Posts.
06:25Now, I have my image there complete with caption.
06:30Let's go ahead and click Update, and view the page.
06:35Now, there's my initial image, and there's my second image, centered as I requested,
06:42complete with a little caption that we see here.
06:45Now, the caption can be easily stylized with CSS as well.
06:50You'll find that with these demonstrated techniques.
06:52You can either add images to the site one at a time, or upload any number to be inserted
06:57as needed by your clients.
Collapse this transcript
Adding videos to posts
00:00An embedded video can really make a blog post jump off the page.
00:04However, you can't use the same techniques you would in Dreamweaver to make it happen.
00:09Let me show you a quick way to embed a YouTube video in a blog post without resorting to
00:14plug-ins or other add-ons.
00:17We'll start by creating a new Post and give it a title Video Production Project Online.
00:26Now before I go any further I want to show you the path not to take.
00:31You might think that Upload/Insert link that we see here is the way to go, especially because
00:37when I open it up, and I go to From URL, there is a Audio, Video, or Other File option.
00:45However, if you follow this process all WordPress will do is add a link to that video or any
00:52other media that you're inserting onto your page.
00:55While that might be right in some cases, in this particular scenario that's not what we want.
01:01So let me go ahead and cancel this, and now I'm going to add a bit of text here into the
01:08post, I'll highlight our Video Production 201 course.
01:13Now I want my video to appear below the text, so I'll create a new line, and now we're ready
01:17to go out and get our code for the video.
01:20Let's switch over to YouTube where I have a Explore California Weekly podcast queued
01:26up that I've published.
01:27Let me play little bit of that so you can see what's like.
01:31(video playing) All right, that's looks pretty good.
01:39Now I'll scroll down a bit here.
01:44If I click on Share another window opens up with a number of various options, including the short URL.
01:50That's already selected, so all I have to do is press Command+C, Ctrl+C of course to copy it.
01:57And that's really all I need from YouTube. You don't need the embed code or anything else.
02:01So let's hit back to WordPress, and I'll paste that in and add extra line Return after it.
02:09Now you won't see a representation of the player in the editor just the URL.
02:14So let's publish a post and then take a look at it in the browser.
02:24There is my title, my text, and my video. Let's check it out by playing it a little bit.
02:30(video playing) Same friendly people in California.
02:38Everything's looking pretty good.
02:41This code, by the way, use HTML5 compliant with a Flash fallback.
02:45So you're covered cross browser and cross-platform.
02:48Pretty sweet, aye.
02:49So there you have it, a quick and easy way to embed a video on your WordPress page.
Collapse this transcript
4. Working with WordPress Themes
Understanding WordPress structure
00:00One of the real strengths of WordPress is its flexibility.
00:04You can easily switch the look and feel of your site to one totally different by activating a different theme.
00:10New pages can be quickly added for any special purpose.
00:14Content can be grouped by custom tags are categories added on the fly.
00:18However, all this flexibility comes at a price. WordPress is a pretty complex application.
00:24In this video I'm going to explain just how WordPress works so that you can get a better
00:30grasp of what your options are when creating a custom blog.
00:34So the first thing that happens is a visitor requests an initial WordPress page: index.php.
00:41This starts the whole ball rolling as in viewing any web page.
00:45Next, WordPress activates the themes.
00:49This is actually the first line of executable code in the WordPress index.php file.
00:55Then WordPress works with a series of template files that are dynamically assembled together
01:00to create the desired page.
01:03So it must check to see which template files are present.
01:07Then it gathers the settings that are stored in the database.
01:10This includes all default settings and any ones that have been customized like the title of the site.
01:17Next to it retrieves the specified number of most recent posts.
01:21The default is 10, but you can set how many posts you want to show through the dashboard settings screen.
01:28Then WordPress stores the post data in a variable.
01:32This includes data about the posts like the title, the author, the date of the posts,
01:37and links to comments--all of this otherwise known as metadata--as well as the content of the post itself.
01:44Then it outputs the data onto a theme page according to the coded layout and CSS styles are applied.
01:51When you customize a theme this is where most of the work lies.
01:55As you can see, there's a lot going on here, and it all happens in the blink of an eye,
02:01and this is just for the homepage.
02:04WordPress is capable of displaying all types of pages, including those for single post,
02:09archives, post under a particular category, or with a specific tag.
02:13One of the key paths to developing custom WordPress blogs is to understand what happens
02:20when these and other types of pages are requested.
02:23Remember this step where WordPress checks to see which template files are present?
02:28A theme doesn't have to have a specific file for every type of page.
02:34WordPress has a template hierarchy built-in that determines what to do if a needed file is missing.
02:41Let me give you an example.
02:43Let's say the site visitor clicks on the author's name--mine, in this example--to see all the
02:49posts that he or she have written.
02:51First WordPress looks to see if there's a template that combines the author prefix with
02:57the author's so-called nice name and uses that if there is.
03:01If there's not, it looks for one with a user id.
03:06If that's not there, it tries to display the generic author.php template.
03:12Should that template be unavailable it looks for a theme specific archive.php, and if that's
03:18not there, it uses the index.php template, the original one.
03:24The WordPress template hierarchy covers all the different use cases.
03:29You can see a complete diagram in the WordPress.org site.
03:33The template hierarchy gives web designers a tremendous degree of control.
03:37You can basically decide how much you want to fine-tune the structure and layout of your
03:41WordPress blog on a page by page basis.
03:44Now that you have a better understanding of how WordPress works in general you're ready
03:48to see how themes fit into that picture.
Collapse this transcript
Activating a theme
00:00In this lesson I'll show you how to work with different themes in WordPress completely altering
00:05the look and feel of your blog with just a quick click.
00:09A WordPress theme controls the layout as well as the styling of a WordPress site.
00:14There are a great many WordPress themes available and customizing one is a terrific way to learn
00:19how WordPress works, as well as developing your own custom site, but before you can gain
00:24access to the theme you'll need to activate it. Let me show you how that's done.
00:29So here we are in the WordPress Dashboard, and I am going to expand the Appearance category,
00:35and you see the very first option is Themes where there are two tabs, Manage Themes and Install Themes.
00:43On the Manage Theme side you'll see two themes ship by default with WordPress.
00:49Twenty Ten listed down below here under Available Themes and Twenty Eleven, which is the currently activated theme.
00:58I could activate Twenty Ten, but honestly there's not a tremendous difference between these two themes.
01:04So that you can get a good sense of the power of themes, let me install and activate another theme.
01:10We'll go to Install Themes, here, where you can, if you like, search for a theme with
01:16specific characteristic as you see here, Colors, Columns, Width, and so on.
01:20You can also browse the Featured Themes or the Newest Themes or Recently Updated.
01:27As I said there are thousands and thousands of themes.
01:31But I am going to kind of cut to the chase here, and let's go to Search, and we are going
01:36to search for a theme called Motion that I thought was kind of really nice and very,
01:41very different from the default themes.
01:43So let's take a look at how that looks in preview.
01:46I'll click the Preview link below that.
01:51And you can see the thumbnail over on the left, and this is just the generic preview
01:57text and setup that is used at every WordPress theme.
02:01As you can see, it has a very different background and a very different feel to the navigation.
02:06Now as I scroll down you can see how the various headings are handled as well as basic paragraphs,
02:14the different list types, forms, and so on.
02:19So I am going to go ahead and click Install and WordPress will download the install package,
02:26unpack it, set it up, install it, and now that it's installed we could do a Live Preview
02:32which would show you what your content look like with this theme.
02:35But let's go ahead and just activate it so we can see it very quickly.
02:39You will notice that the previously currently active theme, Twenty Eleven, has now been moved down
02:45to Available Themes.
02:47So let's take a look at our existing content for the Roux Academy site in the Motion theme.
02:52I'll go ahead and just click Roux Academy here, and there is the Roux Academy titled
02:58there as well as our video production blog and here is our video, and actually it looks
03:06quite nice sitting there.
03:09Let's take a look at the standard blog entry that we had put in here.
03:13Here is the Roux Academy Art Conference with its styling.
03:17I'll go ahead and click on that to go to the single page.
03:20As you can see, it's really a different style, all the way through, including your links
03:25which even have a dotted border below it. Very stylish.
03:29Next, I want to show you one other way to bring in a theme and along the way introduce
03:34you to the simple theme we'll be customizing to create our site-specific blog.
03:40So let's head back to the Dashboard, go back down to Themes.
03:45Here is another way to get to it just roll over Appearance and then choose Themes from the flyout menu.
03:53Now again we'll go to Install Themes, and this time choose the Upload link that you find near the top.
04:02And we'll choose a file, we'll navigate to your exercise files, Chapter 4, and select
04:11the custom.zip file.
04:14Themes are stored as zip files, so you want to make sure that you choose that one rather
04:18than the uncompressed custom folder that you see there.
04:22Click Open and then back in WordPress choose Install Now.
04:27It looks like it's installed successfully. Let's activate it.
04:32Now this is a very stripped-down theme that was created from scratch.
04:37If you're interested in how that was done, check out my course from the lynda.com online training library.
04:43Now let's take a quick look at the site with the theme applied.
04:46Again, I'll go up and click Roux Academy.
04:50As you can see, it's very bare bones which makes it ideal for applying your own custom look and feel.
04:56Here is my video, let's go to the Roux Academy Art Conference. There's that.
05:01Here is the Conference Schedule At-A-Glance.
05:03It looks like we need some styling there to take care of that.
05:08Let's head back to the Home page.
05:11Now you may be wondering how themes fit into the overall site structure.
05:15Let's head back over to Dreamweaver so you can see exactly how it works.
05:20I am going to expand the Files panel here so you can focus on that.
05:31Now let's open up the blog folder, which you will recall, of course, is our WordPress folder,
05:36and there within the blog folder is another folder called wp-content.
05:40So let me open that up and scroll down.
05:45Let me open up the names a little bit here, because it is going to be expanding into that
05:51area and here we see several subfolders under wp-content, including themes.
05:58So if we expand that one, you'll see a different folder for each of the themes.
06:04There are the two default themes twentyten and twentyeleven and the themes we brought
06:09in, motion and custom.
06:11When you're first working with WordPress, you will probably download and try out a bunch
06:15of themes just to see what's available. That's fine.
06:18However, there will come a time when you want to remove any unused themes, especially when
06:23you're turning over a custom site to a client.
06:26Now you can via the Manage Themes area in WordPress delete any unwanted themes.
06:31Let me show you where that is go back to Dashboard > Themes, and if I go down to the Available
06:39Themes here, each of them has a Delete option.
06:43Now you also have the ability to remove themes right from Dreamweaver.
06:46So I'll head back to Dreamweaver where you will see that all you really need to do is
06:51to go in the themes folder and delete the related subfolder.
06:54So let's get rid of motion here. I'll select that and press the Delete key.
06:59Dreamweaver asked for confirmation, I'll click Yes, and now that, that file is gone let's
07:05head back to WordPress, and once I refresh the page, you will see that Motion is no longer
07:13one of my Available Themes.
07:15With basic theme management under your belt you are ready for the next step, child themes.
Collapse this transcript
Setting up a child theme
00:00In this lesson, I'm going to show you how to set up a WordPress child theme.
00:05As the name implies, a child theme is one based on another theme known naturally as the parent theme.
00:11A child theme can inherit styles from the parent while also establishing its own.
00:17Child themes allow you to make any and all necessary changes for a custom blog site while
00:22maintaining the parent theme.
00:24This latter point becomes really important if the parent theme has ever upgraded, as they often are.
00:30So let me start by opening up the style.css for our current theme, custom.
00:36I'll go over to my Files panel and drill down into blog > wp-content > themes, the custom
00:45folder there, and expand that and then scroll down just a little bit more until you find style.css.
00:52Let's double-click that and open it up.
00:54At the top of the file you can see a comment that WordPress uses to get its theme information from.
01:01Here is the name of the file on line 2 as well as the URI of the developer, a short
01:07Description, the Author, and Version number. So we'll use a similar comment for our theme.
01:14Now you know when you install a new WordPress theme it's maintained in its own subfolder
01:19found within wp-content themes just like the Twenty Eleven or the Custom theme we are using now.
01:26So to create a child theme, you need to create a new folder in the themes folder.
01:31So I'm going to right-click on themes and choose New Folder, and I am going to name
01:40this new folder roux, R-O-U-X.
01:44All a child theme actually needs to be recognized by WordPress is its own style.css file, although
01:50you can also, as you'll see, add images, functions, separate pages just like you would any other theme.
01:57So let's create that CSS file now.
02:00I'll go to File > New and then from Page Type choose CSS and click Create.
02:09Well, let's go ahead and save this in our roux folder.
02:13So I'll choose File > Save. So here we are in the site root.
02:18We'll drill down into blog > wp-content > themes, and there's our roux folder, and we want to
02:27save this using the default name used by WordPress, style.css, and once that's saved we want to
02:36get rid of the code that's up top here that Dreamweaver puts in because in order for it
02:41to be properly recognized as a style sheet for theme we have to start with a CSS comment
02:46that is correctly structured for WordPress.
02:49so let's switch back over to our custom.style.css, and I just want to point out if you ever get
02:55confused when you have multiple style.css files open, you can always hover over the
03:01tab and Dreamweaver will show you the entire path, and you can see in there that I have
03:06this as the roux folder and here is the custom one, if you look at the third to last word
03:12there on the right.
03:13Now you also have this option, in Open Documents, which will show you the full path and allow
03:18you to switch from one to the other very easily. So here we are in the Custom Theme.
03:25Let's go ahead and copy this opening comment here.
03:29I'll just select that and press Command+C, then switch back over and Command+V to paste it in.
03:37Most of this stays the same, but you do want to make a couple of changes.
03:41We'll need to change the names.
03:42So instead of Custom Theme, let's just call it Roux, and everything else can stay the same
03:48if it's still accurate, but you will need to add one more line, and that's the template
03:53line which indicates which parent to use.
03:56So you want to put in the keyword template, followed by a colon.
04:00So let's put it right below Author here, Template, colon, and a space, and now you want to
04:07right in not the name of the theme as you might expect like Custom Theme, but rather
04:12the theme's folder name.
04:15So in this situation we are going to be linking to the theme that's in the folder custom with a lowercase c.
04:21So here I'll just put in custom and save my file.
04:25A child's theme style sheet completely replaces the style sheet of the parent.
04:31So if you're not doing a complete overhaul and one of the benefits of doing a child theme
04:35is that you have to, the first thing you want to do is import the parent style sheet.
04:41So now I am going to add my @import statement, and we'll use the URL parameter to point to
04:47the style.css file located in the Custom Theme folder.
04:51And I'll place that right below the comment.
04:55So @import url, open parentheses, starting my quote here, and we're going to be going up a folder,
05:04so dot-dot slash, the name of the folder we're going into, which is custom, another slash to go back into
05:12that folder, and then style.css. Close the quote, close the parentheses, and put a semicolon at the very end.
05:21Okay, we'll save our file, and we are ready for the last step in setting up our child theme, activation.
05:29So let's go back to the Dashboard, and we'll go to our Themes category, and now you see
05:36there's a new theme that's available to us, Roux.
05:40You will notice that, of course, this doesn't have a graphic, that's because we don't have
05:44an image named screenshot within the Roux Theme folder, but that's okay for now.
05:49We don't really need one.
05:51So now if I go over the Details option, here, and click on that, you'll see some of the
05:57information that's pulled in from the comment, our version number, our short description,
06:02and it also tells you, and this is kind of important exactly where the template files
06:07are located and right now because this is a child theme, template files are located
06:12in themes/custom and the stylesheet files style.css, in other words, are in themes/roux.
06:21It goes onto say that roux uses templates from Custom Theme making it very clear that
06:25this is a child theme working with the parent custom. All true.
06:31So all we need to do now is click Activate, and now our new theme is active, and if we
06:37were to preview it, we'd see exactly what we saw before with custom, because we're using
06:43its exact stylesheet.
06:45But the important thing is now that this part of the work is done we are ready to move on
06:50to complete customization.
06:52You'll find that child themes are pretty straightforward to set up, and as you'll see it's a perfect
06:57vehicle for your custom designs.
Collapse this transcript
5. Customizing a Theme
Updating the page structure and the background
00:00In this chapter we're going to work with the child theme setup in the Chapter 4 lesson--
00:05which was appropriately named setting up a child theme--so that our basic WordPress page
00:10fits in with our existing site.
00:12We'll take an outside-in approach starting with the page background and the basic page structure.
00:18When I'm working on a project like this, I always develop a comp in HTML first.
00:22The comp will give us the precise CSS declarations we'll need to replicate a design, as well
00:29as clues to the required underlying structure.
00:32Let's open up the blog comp for this site, which you'll find in the website files within
00:37the _source folder you see here, and it's called blog_comp.htm.
00:43So let's go into Live view so you can just take a quick look at it.
00:48And if I open up the index page from the site, you see that it's, basically, kind of the same thing.
00:53Let me actually go and choose another page, that's a little bit more basic like about.htm,
01:01and I'll go into Live view there.
01:05So here's the basic look and feel of the site, and you can see there's a big footer down
01:09at the bottom, a sidebar over on the right-hand side, header graphic, and so on.
01:14Now my blog_comp looks very similar.
01:16I've got a specialized header graphic, main content area over on the left, and a sidebar
01:22over on the right, and this is styled to be uniform rather than having multiple boxes.
01:27But that's just a design that we chose here, and we have the same kind of large footer
01:32area at the bottom. Now let's open up index.php from the blog site.
01:40So I'll go to blog and double-click on index.php and enter into Live view and then let me dynamically
01:48discover all the files.
01:50Again, Dreamweaver will put up a script warning for us, we just click Yes.
01:55Okay, it's found all of our files.
01:57Now let me close about.htm so we can compare our Apples to Apples here.
02:02We're in a Live Design view in both of them.
02:05So here's our existing blog page and here's what we're aiming for.
02:09As you can see, we have quite a bit of ways to go.
02:13Let's scroll down so we can look at what constitutes the footer, and it's very basic down at the
02:17bottom whereas I have a much more elaborate footer.
02:22The other major difference is, of course, that the sidebar appears to be over on the right
02:26in the blog comp, and it's on the left in our current page.
02:31We'll eventually get to working out all of those details, but as I said, I want to start
02:36from the outside in, and this will be a little bit more noticeable if I close off my panels here.
02:44So the first thing that I notice is a big difference is the background color.
02:47Here, on this page, we have a basic light gray and then, here, on this comp is a much darker
02:55gray, obviously a very specific color.
02:58So let's open up the Styles panel again, because we're going to be using those quite a bit,
03:02and I'm going to open up my CSS Styles panel, expand that just a bit, and we see that over
03:12here on this side, all right perfect.
03:14So the first thing I want to do is pick up the value of the background color by using
03:19the Inspect feature that we see available to us once we are in Live mode.
03:24So I'm going to go ahead and just click on Inspect and then roll over the background
03:30a little bit and go ahead and click once to lock that in.
03:35Now we want to make sure that your CSS Styles panel is in current mode, and that will give
03:39you the most current files.
03:41I'm going to shrink down the Files panel so we can see a little bit more of our CSS styles
03:47panel as we're working with that exclusively now.
03:49So now I'm looking for the background color, and I have to discover where that is.
03:53Now because I inspected the body tag, that's the first one you'll see here in the Rules
03:58Pane, but if you just scroll up and click one tag after another--climbing the tree if
04:04you will--until you come across a background color or background property as we see here
04:10in the HTML tag, you can easily find the background color that's applied.
04:14So all I need to do now is click into the Properties area there, and I'm going to copy
04:19that value add let's go apply it over on our comp.
04:23So we'll do the same thing and then Live view, and I'll choose Inspect and scroll over to
04:29the outer area where we see that and here very quickly we see that the background is
04:37applied on the body tag.
04:39Now we want to find out exactly where that is applied.
04:42Now if you go up here and hover over body in the Rules Pane you'll see a little tooltip
04:47that tells you that the rule is defined in style.css.
04:52So a good thing to do at this point would be to use the Custom Filter up in the Related
04:57Files Toolbar that will allow us to hone in on the style.css file.
05:03So let's open that up, choose Custom Filter, and then in the Custom Filter dialog enter
05:10in style.css in the field and click OK.
05:16Now you'll see that there are actually two style.css style sheets, one that is connected
05:23to our Custom Theme folder and one that goes for our Roux child theme folder.
05:29We want to put any styles that we create in this style sheet, the one that is stored in the Roux folder.
05:36And we do that so that we keep the style sheet and all the other files that are in the parent
05:42theme as they were, so in case they ever get upgraded we don't lose any styles or modifications that we've made.
05:49Now you may recall that we had two different selectors in use here, blog_comp had the background
05:55color applied to the HTML tag, whereas on the side it was applied to the body tag.
06:02So we want to use the selectors that are found in our child theme and not the ones that are in the comp.
06:09So I'm going to put in body open up a curly brace, background, and I copied in that
06:17value so it you can just pace that in, put in a Semicolon, let's make in a little
06:22bit more room--let's see that all in one line-and then close off the curly brace.
06:28All right, first rule is done.
06:30Now if we click back into our Design view, and let's give it just a little bit more room
06:36here, I'm not going to see a whole lot of it but there's a thin gray right there.
06:39Now, you won't see it until you hit Refresh.
06:41I'll tell you what, let's go to Design view there so you can actually see the background
06:46and so you can see, now we have that same dark gray color. Great.
06:50Well, let's continue working our way from the outside in.
06:53Next stop is the width of the page. Let's take a look at the comp.
06:58I'm going to click on Inspect and then try to locate the full width of the page.
07:04One way to do this is to hover over any element and then you actually use your arrow keys
07:09to climb up the DOM tree if you will.
07:12So I'm going to click my Left Arrow key which will go up the tree, as you can see, every
07:17time I do, I'm now on article in the mainContent area, if I click it again, it's going to go
07:22to the div that surrounds just the content called the content wrapper, my header is still
07:26not brought into play and then, it goes to the blog around the body page.
07:32Okay, so again, we have the width that's on the body tag, and it's at 960 pixels, and
07:40let's head on over, and let's find where that width should be here.
07:44So I'll start in the header and again, pressing my Left Arrow key to step up of the DOM, I'll
07:50go, there's the header area, there's the outerWrapper, and that seems to be the width.
07:55This is pretty common, in a lot of designs, you'll see a div named wrapper or outerWrapper
08:01or something like that, that will hold the page elements together.
08:04Okay, so this is where we want to be, but rather than change the width right here on
08:08outerWrapper which is stored in the style.css file that is found in the Custom Theme folder,
08:16we want to go to our Roux theme style sheet and put it in there.
08:20So it's an id of outerWrapper and a width of 960.
08:33Now I notice that there were a couple of other properties associated with that same rule
08:40that I may want to pick up. Let's go ahead and take a look at those.
08:42Here we have margin 0 auto and position relative.
08:47Let's go ahead and bring that in.
08:48Margin 0 auto is going to center our page and position relative, it's kind of an odd
08:53one to have for body, so it probably has some impact on the way things are laid out.
08:58So to get through those properties, the easiest thing to do is to right-click on body on the
09:03Rules Pane and choose Go to Code, and there's our rule starting at 160, and I'm just going
09:10to copy those two properties and then, head on over to our style sheet here and paste them in.
09:18So I'll save this style sheet here.
09:21Now the last aspect of the page I want to check is its basic structure.
09:25So I can see if I need to make any fundamental changes to the WordPress page.
09:29One really good technique for viewing the structure of a page is to use Dreamweaver's
09:34Live Code view in conjunction with code collapse.
09:38Let me show you what I mean.
09:39So let's go back to the comp page, and I'm going to enter into Live Code view.
09:46Let me open up a Code view all the way, so we can take advantage of the larger screen size.
09:52You'll recall that the yellow background indicates that Live Code is not editable.
09:55But that's okay, all we're doing is looking.
09:58So let's scroll down to the body section, which starts on line 13, I'm going to scroll down
10:04a little bit more to bring it up.
10:08Our first major division is the header tag, not a surprise as we saw that the page width
10:12was controlled by a CSS rule for the body and not for something like outerWrapper.
10:17So let's collapse the header and see what's next.
10:21To do that place your cursor right after the header tag and then go up to the third icon
10:27which says Collapse Full Tag and click that once, and that will invoke the Code Collapse
10:33feature, and I can bring it back if I want by clicking on the arrow here and collapse
10:38it again by clicking that same arrow.
10:40Okay, so we have the header, looks like the next major structural element is the contentWrapper.
10:46Let's leave that open so we can see what content it wraps around.
10:49The first major division within contentWrapper is an article tag with an id of mainContent.
10:54So let's collapse that, again put my cursor right after the close of the article tag there,
10:59and go to Collapse Full Tag and then the next division is on aside, again, let's collapse
11:05that, and there we see that that's all that's within contentWrapper.
11:09Okay, we're moving right along, looks like we have a footer here, let's collapse that
11:14one, and that finishes up the page.
11:17So there's our page structure, body, header, contentWrapper, which contains article and
11:24aside followed by footer. Now let's do the same thing on our index page.
11:30I'll go over to index.php, I'm already in Live view, so I just have to go Live Code
11:38and then let's go to code view, and I'll scroll up to around where the tag is.
11:44So let me clear the selection just by clicking in and my cursor now is right after outerWrapper
11:49but again, because this wraps elements we don't want to collapse this one.
11:53Let's go to the next element that it contains which is header, so I'll put my cursor right
11:58after the opening of the header tag and collapse that, and now we come to another wrapper,
12:03contentWrap and again we'll go to the next division after that.
12:08So this one is a div with the id of content, let's collapse that, and then we find another
12:13div with the class of widget-area, that's our sidebar, and let's collapse that and then
12:20there's the footer, let's collapse that.
12:22So now we have this structure which is body, outerWrapper, header, contentWrapper, the
12:30div that contains our sidebar, and then the footer.
12:33And if we compare the two, we can see that they're basically the same thing except for an outerWrapper.
12:38The important thing is that the content is followed by the sidebar the same way for both.
12:45So we won't have to make any major structural changes, and that means we're ready to start
12:49working on the page elements themselves starting with the header.
Collapse this transcript
Working with web fonts
00:00The emergence of web fonts is one of the most far-reaching innovations in web design in recent years.
00:06Finally, designers are freed from the stranglehold of just using system fonts.
00:11The general Roux Academy site makes use of several web fonts for both headings and body copy.
00:17So we'll want our blog to follow suit.
00:20Although it's an essential step it's no big deal just copying and pasting a set of files
00:25and a chunk of code.
00:27You can tell that there is a web font in use, if I click right into this h1 tag, here, and
00:33then look over in the Properties Pane, you see font-family Bitter comma Georgia et cetera,
00:38Bitter obviously is a web font, and there are others that are in use throughout the site.
00:44So those fonts are stored locally.
00:46So I'm going to go ahead an expand the Files panel and locate those in the rest of the
00:52site and they're in a folder called _fonts, so I'll just open that up, and you can see
00:57there's a quite a bit of them there, Bitter is being used as well as one called DroidSans.
01:03Now I want to go ahead and copy this entire folder, so I'm going to select it and then
01:08press Command+C, of course on the PC you would choose Ctrl+C.
01:13Now we want to take this font folder, and we want to put it in our child theme folder, which is roux.
01:19So let's go down to the wp-content folder, and then within the themes folder locate roux,
01:26and I'll just go ahead and expand that, so you can see right now all we have in it is
01:30style.css, and then I'm going to use Command+V to paste in my copied fonts. All right.
01:37Now let's move into the code. I'll shrink the Files panel.
01:41I'm going to go ahead and just go to Code view and make sure you are in main.css.
01:47This is for our blog_comp and the rules for web fonts are typically stored at the top
01:52of the page, so I'm going to scroll up there, and here you can see the start of them is
01:56quite a number of rules, I think there are five in all.
01:59So I am just going to copy all of those, starting with the little comment there, Font declarations,
02:08and then ending with the last @ font-face rule for DroidSans.
02:12So again, I'll go a Command+C to copy it, and now let's go over, and we'll close up
02:20the CSS Styles panel for a second just so I can scroll up and go to my index.php page
02:26that's located in the blog folder, I'll open that up, and let's click on Discover.
02:31I'm going to go ahead and click the Don't warn me again, because we're going to be doing
02:36this a lot, and there's no need to have to click the Yes button each time. All right.
02:43Now I'm going to set the Custom Filter to style.css, click OK, and there's our two style.css sheets.
02:54The first one is the one for the roux folder, as you can see, and we want to continue to
03:00put our web fonts close to the top.
03:03We'll put it after the import url declaration, so I'll put my cursor at the end and then
03:08make a new line and then, Command+V to paste them all in.
03:12But since we already have a body rule established which I'll scroll down to, let's go in and
03:18add the font-specific declarations.
03:20Again, I'm going to go back to my blog_comp.
03:24So now I'll scroll down a little bit to where the font declaration is you can find that
03:29on line 87 and the declaration we're mostly interested in is the font declaration.
03:35Although we want to go ahead and pick up these other ones as well, so I'm going to go ahead
03:39and select all of the declarations in body, copy that, head back over to index.php, put
03:47my cursor in the body rule and paste them right in.
03:52So I'll save this file, and we're done.
03:55Now I can be assured that when I begin to set the styling for various elements on the
03:59page my web fonts will be ready to go to work.
Collapse this transcript
Styling a header
00:00So far in this chapter we have changed the background and the page width as well as adding
00:05web fonts to match our site.
00:07Now we are going to work our way from the top down, starting with the header.
00:11So I have both the blog_comp.htm file found in the _source folder, as well as the index.php
00:18file from our WordPress blog folder open, am in Live view in both documents.
00:24WordPress is very big on dynamically building the page by including its constituent parts.
00:30The header is one such part and typically includes any pre-HTML code, the opening HTML
00:37tag, the entire head tag, the opening body tag, and any header area prior to the content.
00:45So in this theme, it's going to be this entire section up to, and including, this border that we see here.
00:52Now, all of this code is contained in the header.php file.
00:57So to preserve our parent theme, let's copy the header.php file from the custom theme
01:03folder to or roux theme folder.
01:05So over in the Files panel, I am going to expand the custom folder, locate header.php,
01:12press Command+C to copy that, close up custom, and let's just open up roux and then paste that in.
01:20So there's our header.php file and while we are at it, we are going to copy some images
01:25that we'll need to the roux theme folder as well, and those are located a little bit higher
01:30up in the root of the site, because we are going to be bringing in images that are used
01:36throughout the entire site.
01:37So I am going to copy these three files starting with blog_header01 through blog_header03.
01:44I also, I'm going to need this diagonal pattern PNG, here, so I'll select
01:48that as well, and then I need the Roux Academy logo, which is located here as the ralogo.png.
01:56So I am going to just press my Command key and do a selection there.
02:01So I should have five files as 1, 2, 3, 4, 5.
02:04Let's copy those with the Command+C and then I scroll down and rather than just dumping
02:10them in the roux folder here I am going to create another subfolder, right-clicking on
02:15roux, choose New Folder, and let's keep things consistent, so I'll name this _images and
02:21with that still selected, I'll press Command+V and copy in those files.
02:28Let's tidy up our Files panel a little bit.
02:30Now, one thing I have discovered, now Dreamweaver is pretty good about reading in new files,
02:35but I found there are sometimes you really need to give it a helping hand.
02:39To show you what I mean, let me locate the header.php file here, and one way to do that
02:45is to scroll through the various files.
02:47I happen to know that it's located right at the end there, so I'll scroll all the way
02:52to the end, and if I hover over it, you can see in the tooltip and look over on the right
02:56of the tooltip, it's custom:header.php.
03:00So this is the header.php file that's in the custom folder, that's not what we want.
03:05So let's close the index.php, and we'll reopen it.
03:10I am just going to go to File > Open Recent and choose index.php.
03:15Now we'll discover the files again, and this time let's use the Custom Filter to go right
03:21to the files we need.
03:22We are going to be needing the style sheets, so style.css;header.php, click OK, and now
03:33if I hover over header.php, and you look at the end of the tooltip, you'll see that the
03:38folder the header.php file is in is the roux theme folder, exactly what we want.
03:44So let's go ahead and go into Live view, and now we are ready to bring in code from the comp.
03:49So we are going to switch over to the blog_comp, go to Source Code, and let's just go ahead
03:54and click right into the header area here.
03:57And what I want to do is I want to bring in the codes starting with header here, so I
04:01am going to bring in actually the entire tag, so I'll again put my cursor right after header
04:06and then choose Select Tag, and once that's selected, I'll copy it with Command+C, then
04:13move over to index.php, click on header.php, let me just go ahead and switch to Code view
04:20momentarily here, so we've got a good view of what's going on.
04:24And I'll scroll down, and I want to replace this entire header area here.
04:29So with that selected, I'll just press Command+V.
04:34Now one thing I want to show you, if you go to Design view now or Split view and just
04:39click Refresh, you might be surprised that you don't see the new header information.
04:44That's because with Dreamweaver, while it will pick up styles if you just click Refresh,
04:50anything else such as changing the code in the header.php or footer.php as we'll do later,
04:56won't be picked up until you save that file.
04:59So let's go ahead and I just want to click into header.php here, and I'll do a Command+S to save the file.
05:06Now if I hit Refresh, there's my new navigation.
05:08Now, you can see that the links that we have here on the code side are relative, and we're
05:13going to have to adjust those, but let's stay focused on the styles for right now.
05:17So I am going to go back over to my blog_comp.htm, switch to main.css, and let's locate all the
05:25CSS rules that have to do with the navigation.
05:28One great way to do that is to use the Inspect tool.
05:30So I am in Live view, I click Inspect, and I am just going to go over to the navigation
05:35area, click once just to lock that down, and now let me open up CSS Styles panel, and you
05:41can see that I'm already in the Links area here, and if I scroll up, you can see that
05:46there are numerous link related styles.
05:49So let's go ahead and right-click on pageHeader ul and choose Go to Code so we can go right
05:55to that, and now I see the beginning of these styles here, and if I scroll up a little bit
05:59more, I want to make sure that I get them all, and I can see that I actually have a
06:03Nav styles section.
06:06So let's select all of that, and I'll go up to, but not including, page-specific header
06:14styles on line 229, copy all of those files and then switch over to index.php, and you
06:21want to make sure that you go right into style.css.
06:25So I am going to go to the bottom of my page, and just make a little room here and then
06:35paste those in, and now let's hit Refresh. And, as you can see, I didn't have to save
06:42my style sheet like I did have to save the header page. Just one of those little quirks
06:47in Dreamweaver, but now we have a navigation working. But what about the logo image?
06:52Let's head back over to blog_comp.htm and inspect that, see what we can find out about in there.
06:58So, if I scroll over to here and click down, there I see my .blogHeader, and that seems
07:05to be a background image, but that's not really the logo.
07:09The logo seems to be associated with this h1 tag here so if I click on that. Ah.
07:16Here we go, .pageHeader h1, and there is my RA logo.
07:20So let's use Go to Code for that, and there is Header Styles section, so I am going to
07:27copy that particular one.
07:29It looks like we have got a couple of rules. Now sometimes placement is important.
07:34So I notice that these rules even though we came to them second, are above the Nav styles.
07:40So I am going to put that in the same relative position after I copy it, move back over to
07:46index.php, scroll up above the Nav styles and paste in my Header styles here, clean
07:53that up a little bit.
07:55So now if we click Refresh, we can see that a box has been made for the logo, but there is no logo.
08:04When you don't see an image that's supposed to be brought in by the CSS, typically that
08:08means that the path is wrong in some way.
08:11So here's our rule right here, the background is looking for an image that's up one level
08:18which is true with the blog_comp, but it's not true with our index.php page.
08:24So let's get rid of that additional dot-dot slash that we don't need, and I'll click Refresh one
08:28more time, and there is our logo.
08:31So now the only thing that's missing is our background image that is located within the blogHeader.
08:38So let's go back over to blog_comp, and I am going to inspect one more time, you can
08:44see we use this religiously, and there it is .blogHeader, let's go to code, locate that,
08:52and I am going to copy that rule, head back over to my page, and I am just going to put
08:59this in between the two here, the Header styles as well as the Nav styles.
09:05Let's save that page, and now click Refresh and again we have space, but no image.
09:13So let's get rid of the unwanted path and click Refresh one more time, and there is our image.
09:20So let's reduce the Files panel over here and go to Design view, so we can get a good
09:26sense of what it is we still need to do.
09:28So it looks like there's some additional padding that's going around the outside, and we have
09:33a border that's appearing on the top here as well as a little extra margin space it looks like.
09:41So let's go ahead and figure out what the problem is there.
09:45Sometimes the issue is not that you don't have the styles put in place yet, but you
09:49have too many styles. So let's open up our panels again.
09:56This time let's do the inspection on our index.php page.
10:00So I'll turn on inspection, and if I hover over the .blogHeader, I can see that there
10:05is some additional margin that's appearing down below it, and if I click in to lock that
10:11in, it's not the header tag, so let's keep going up.
10:15Well, there doesn't seem to be any additional margin on that outerWrapper tag. What about this one?
10:21Well, here I see I do have 10 pixels of padding here, and we want to get rid of that.
10:28So I am going to go to this outerWrapper tag, which as you can see, when I select it in
10:33the Rules panel shows that my style.css file is selected.
10:38So I can go ahead and actually take advantage of that and put in the rule here.
10:43And I am going to set that padding to zero.
10:46Well, that tightens things up very nicely, but we still have this border issue here.
10:51So let's use Inspect one more time.
10:53I'll go in here and click on that and again let's click on the border.
10:59Well, here is the real problem that we are finding, the header has a border bottom that
11:05we don't need, and it also has a margin bottom that we don't need.
11:09So there is no equivalent rule defined yet in my style sheet for the roux folder.
11:14So let's open that up, I'll go to Split view, and I always going to put that right after
11:18blogHeader here before the navigation.
11:22That's addressing the header tag, and we want to get rid of the border-bottom altogether.
11:27So I am going to do border-bottom: none, and we also have a margin-bottom that I want to
11:36get rid of, so margin-bottom: 0.
11:39Let's close out the header and refresh the page. Bingo.
11:43That looks great. So stylistically we are rocking.
Collapse this transcript
Adding header functions
00:00Let's say I try to click on something, I'll make sure that my Follow Links Continuously
00:06is set up, and if I go to about, you will see that the file is not found. Because what it's
00:13doing is it's going to the about path within the blog, not what we want at all.
00:21So to tackle this issue, we are going to need to integrate a little WordPress specific PHP code.
00:27The first area I want to address is the logo link.
00:31This goes to the site home and not the blog home.
00:34So to handle this situation, we are going to need to bring in a custom function.
00:37Luckily they are pretty easy to write just basic PHP and even easier to implement.
00:42Now if you look at the custom theme folder, which we can do pretty easily by expanding
00:48the Files panel, you can see a file called functions.php.
00:54Unlike with the header.php and other related files like footer.php and index.php, we don't
01:01want to paste a copy of that file into our child theme folder.
01:06Having the same functions twice breaks WordPress.
01:09So, what we need to do is to create a new PHP file, name it functions.php, and save it
01:16in our child theme folder.
01:18Then we can add any custom functions that we need to.
01:22So let's collapse the Files panel.
01:24I'll go to File > New, choose PHP under the Page Type, make sure None is selected under
01:31Layout, and click Create.
01:33Now I am going to go ahead and save that, and we want to save this in the Site Root,
01:41and we'll drill down to the blog, to wp-content > themes > roux, and we are going to name
01:50it functions.php, same name as the other file.
01:56So I'll go to Code view, and we are going to strip out all of the HTML here.
02:01This is a pure PHP page.
02:03So I am going to save that one more time, so we have our file pristine and ready to go.
02:08Now, let's open the Code Snippet, which you'll be able to find in the exercise files, so
02:13I'll go to File > Open. So here's my custom function.
02:17Let me quickly walk you through the function so you know how to apply it.
02:21Function name is siteRoot.
02:23It brings in an argument called theFolder and then the first line sets up a variable
02:28home that uses a WordPress function that returns the entire blog URL.
02:34Next, thePosition, another variable, is set to a string function called string pose or
02:40string position that finds where that argument is located in the string.
02:45So basically what we have here is the entire home URL, which is going to be something like
02:50http://localhostrouxacademy/blog, and it's going to find where the folder name, the folder
03:00string, which will be blog, is passed in and then the next line, code line 7, sets up another
03:07variable that extracts everything except for that particular passed in bit of string, the
03:14folder name, so we get just the first part of the path, which is exactly what we want. All right.
03:19So let's copy this, move over to functions.php, paste it in, save the file, and I am going
03:28to go ahead and just close down these files.
03:31And now with these functions in place, we can actually go back to Dreamweaver and add
03:36the necessary code to the links.
03:38So we are going to be doing this in Code view in header.php.
03:43So let's scroll up a bit until we find the a tag that links the logo which is right here in the h1.
03:51So I'll put in my opening code block and just to get rid of the little syntax error messages,
03:57let's close off that code block, and now I want to display the results of my function
04:02so I'll type in echo and then my function name, which is siteRoot and an opening and
04:08closing parentheses as well as the closing Semicolon.
04:12Now we want to pass in the path of the folder name that we are going to extract, and this is blog. All right.
04:21So let me save the file, and we'll take a look and make sure that that's working.
04:26So I'll go into Design view, and I'll click Refresh here to make sure that I've got all
04:30the latest updates, and now I want to go ahead and make sure that when I click the logo here,
04:35it's going to go to the website homepage, not the blog homepage.
04:40Let's make sure that my Follow Link Continuously is selected, so it is.
04:45And when I hover over the logo and click on it once, it does in fact go to my homepage.
04:50So my function seems to be working properly. Now let's go back and finish off the coding.
04:55I'll click on home here and then click on header and go to code. All right.
05:01Now since almost all of my main navigation links reference locations based on the site
05:06home, I can reuse this same PHP code.
05:10So I am going to go up, copy it quickly, and then place it in front of all of my links, except for one.
05:19So there is Programs, Admissions, Student Portal, Campus Portal, Alumni, and I am going
05:29to skip over the blog page and then do about. The one exception, of course, is that blog link.
05:37Here I can take advantage of a WordPress function that provides the URL for where WordPress
05:43is stored within the blog site, and that function is site_url.
05:49In this case, the word site refers to the WordPress site, not the overall site.
05:56So I am going to put my cursor right in front of where it says blog/index and put in another PHP code block.
06:05We'll also want to use the echo term, and this time we are echoing that WordPress function
06:10site_url with an open and close parentheses, no arguments, and a closing Semicolon.
06:19Now my last action is to adjust the path a little bit.
06:23Because it's pointing to the site_url, which is Roux Academy/blog, I don't want to leave
06:30the word blog here.
06:32So I'm going to remove that, and I am going to keep this trailing slash here.
06:38WordPress functions that return site locations always leave the trailing slash off, so you
06:44will need to add that in.
06:46My custom function siteRoot on the other hand includes the blog and only extracts whatever
06:51it is that you had included as an argument. Okay, we are ready to check the work.
06:56So I am going to save our files and go back to Design view.
07:01Let's click Refresh to make sure we've got the latest version, and now I'll click on
07:06about, and we go to the about page, that's great.
07:10Let me go back a page, our logo link to home works, that's great, let's go back a page.
07:16Now let's just try out the blog link, which should just refresh this page.
07:22And there we are, perfect.
07:24In this lesson, you saw how to bring code in from your comp, both HTML and CSS rules
07:30to whip the header into shape.
07:32You also got a chance to incorporate some WordPress PHP functions to make the links
07:37work correctly. Good job.
Collapse this transcript
Setting up content columns
00:00The next section of the WordPress page we're going to turn our attention to is the main content area.
00:06In this lesson, we'll address the general content wrapper that includes both the primary
00:10content div and the sidebar as well as style in the content area itself.
00:16Along the way, we'll make some minor adjustments to the WordPress PHP code.
00:21Just as WordPress uses a file stored in the theme folder called header.php to contain
00:26all the header elements, the code for the main content area, which you see here on the
00:32left under the heading Roux Academy Blog, is in another file, also stored in the theme
00:38folder with the name of index.php.
00:41Now, this is not to be confused with the main index.php stored in the WordPress root.
00:48To customize this, we'll need to copy the index.php file found in the custom theme folder,
00:54and paste it in the roux theme folder.
00:57So I'm going to go to my Files panel and expand it, so we can work a little bit easier.
01:03Scroll down a tab until we're in the wp-content area.
01:07And here, I have my themes already expanded, and there's custom and roux.
01:11So let's open up custom a little bit.
01:14There is that index.php file that I mentioned. I've selected it.
01:19Now I'll press Command+C to copy.
01:22Select the roux folder and Command+V to paste it in. Okay.
01:27All of our preps done, let's tackle that content area.
01:31So, I'm going to go ahead collapse the Files panel, and then let's go and make sure we're
01:39pulling in right from the blog, it's kind of hard to see down here.
01:46Right below the blog folder is my index.php.
01:50You want to make sure that you've got the right one you're working with.
01:53So, double-click that to open it.
01:56Let's discover the files and go right into Live view.
02:01So, for me, the guerilla on this page is pretty obvious.
02:05The sidebar in the comp that we see here is on the right.
02:10While in the current WordPress page, it's on the left.
02:14Let's see how that's done in the comp and make any necessary changes.
02:17So I'm going to head on over to my blog comp, and I'm going to collapse the Files panel
02:23here just so I have a little bit more room we're going to be mostly working with CSS
02:27styles for a little bit. So, we're in Live view.
02:30Let's turn on Inspect mode, and I'm just going to go into the content area.
02:34I have my h1 tag there highlighted.
02:37I'm going to walk up the DOM tree by pressing the left-arrow key just to see what we get.
02:43So if I look over in the CSS Styles panel, I see that main area that we see there is
02:49article#mainContent, and that seems to be this main area on the left.
02:53So, in this article with a id of mainContent, and I look at the properties.
02:59I see that there is a float: left property. Well, that's key.
03:03And this rule also has the widths and margins involved.
03:06So, let's go ahead and click once to turn off Inspect mode and then I can right-click
03:12on my Rule in the Rule pane here, and choose Go to Code.
03:18And that will take me right to article#mainCcontent, and I'm going to copy these properties here.
03:24I know since working with this that we don't have exactly the same selectors in my index.php file.
03:30Instead of mainContent, our selector over there is called just content.
03:34So, I'm just going to copy the properties. Let's narrow down our files here.
03:42We'll go to the Custom Filter.
03:45The files we're going to be working with primarily are style.css, put in a semicolon, and also index.php.
03:51There are our two style sheets.
03:56Let's go to the first one which as I hover over it, I can see is the one that's in my Roux Theme folder.
04:02I want to add in those properties that I had for the content area.
04:07I'm just going to scroll down past the header styles and the nav styles.
04:12Go all the way to the bottom here, and just so you know just to double-check and make
04:16sure I've got that div give right, I am going to just click right into this area here, the
04:21main content area that we see.
04:23And if I inspect that in a similar sort of way, I can see that I did remember it correctly,
04:29that there is a div called #content.
04:33You want to make sure that even though you may think you remember something properly,
04:37there's a lot of selector names going around, so sometimes double-check that.
04:41So, I'm going to make this content, and then just put an open and closing curly brace.
04:48And if you recall, I copied just the properties, and I'll paste those in.
04:53Let's go ahead and refresh the page. It looks like that was successful.
04:57There, I've floated the content to the left, but that just is half the battle.
05:04If I scroll down a little bit, you'll see that my sidebar area is now also on the left
05:10here, and we want to float that one as well.
05:14So let's head back to our comp, and see what we can find about how that is handled.
05:19I'm going to scroll over a little bit here.
05:23He's my good friend, Inspect, and again, I'm just going to hover over a little bit of the
05:28content in that area, and then walk up the DOM to find exactly what it is we're working with.
05:35So there's the rule for the widgets.
05:37I'll press my left-arrow key again, and here we're getting a little bit closer into it.
05:42Here we see a section.info. That seems to be part of it.
05:47But if I look down at the tag selector along the bottom of the screen, I see that section.info
05:53is actually within a within aside.
05:55So let's go up again, again pressing left-arrow key, and there's my aside, and I see that
05:59it does have a float: right with a particular width, 318 pixels. Perfect.
06:04So, I'll click once on the screen, turn off Inspect mode, right-click on aside rule to
06:11Go to Code, and there it is right there. So, let's copy these properties.
06:17Again, we have a different selector named in my comp, and I'm going to scroll down and
06:23find, I believe it's called widget area, but I'm not absolutely positive of that.
06:28So, let's go into Inspect mode, into the sidebar text, and again creep up the DOM, and I'm
06:35right, there is a widget area.
06:37I don't have that defined in this style sheet, it's in my parent style sheet.
06:41So I need to add that in.
06:43So it's a class widget-area, and again, we'll open and close those rules, and I will just
06:53paste in those two rules. All right.
06:56Let's hit Refresh here and see if that works its magic.
06:59And if I scroll up, indeed, so we're moving along pretty well.
07:03We have the sidebar in its proper place.
07:05Now, we can address the look of these columns, specifically the equal length of the columns.
07:11In the comp, this is accomplished, as I said, by using a image, and let me actually, sometimes
07:20I'll click on Edit Rule if I can't see everything.
07:22I can go in here and find it pretty quickly, and that will open up the CSS Rule Definition
07:27dialog box, and I can see that it's a image called blog_content_bg. it looks like PNG.
07:34So, that's good. So we'll need to get that file, and bring it in.
07:38I'm going to go back to my Files panel, expand it so we can find our work easily.
07:44And this time, we're going up to the _images folder that's found in the site root.
07:49I'm looking for blog_content_bg.png, and there it is. So let's copy that.
07:55We want to paste it in, you guessed it, our child theme folder and the _images folder.
08:02So I'll just expand that, so we can see what images we already have, and verify that it gets pasted in.
08:08I'll press Command+V, and there's that image. Okay.
08:13We can collapse the Files panel one more time.
08:16So, we've got the file moved, but now we have to get the rule.
08:20Let's go to this particular rule here, right-click on it, and go to code so we can get all of
08:27those properties, and head back over to our Roux style sheet.
08:34I'm looking for whatever the wrapper is that's around these two content areas, the main content
08:40area and the sidebar.
08:41So, let's use our friendly Inspect mode again, and again highlight an area, and go up the
08:47DOM with first one press of the left-arrow, and we don't have our wrapper quite yet.
08:53Let's keep going this tree, up again, #contentWrap. All right.
08:57So we're looking for a property called #contentWrap.
09:01And I do not believe I might have something already defined in that area, #outerWrapper,
09:06no, but no #contentWrap. Okay.
09:08So that's fine. Let's go down.
09:11And I'm going to put it actually above content wherever possible.
09:14I like just as a best practice it makes it easier for me to find things to kind of put
09:18things in a logical order.
09:21So, my #contentWrap is around the main content area and the widget-area, the sidebar.
09:27So I'm going to put that ahead of things.
09:29And again, put in my curly braces and paste in my properties.
09:33Now you'll recall that earlier we've had to adjust the path for any images that we bring
09:39in, in the background, and we'll do the same thing here.
09:41We're going directly to that folder now in the child theme, so we don't need to go up
09:46a level as we did with the blog comp. So, let's get rid of that path.
09:50Now, I'm going to save the file, and click Refresh.
09:55Let's head to Design view, and there's our full column, design.
10:01Obviously, we are going to have some work to do over on the sidebar to bring that in.
10:06But things are now looking relatively good.
Collapse this transcript
Changing the main content
00:00So now if I do a little comparison and see where we're at with our blog_comp.
00:05Well, the first thing is I've got a title, Roux Academy Blog, to put in that I don't have in index.php.
00:13So, let's go into the actual index.php page.
00:17I'm going to open it up into Code view so you can see what we're working with here.
00:23The index.php page is really the centerpiece of the entire WordPress site, and it acts
00:30as pulling in the various parts.
00:33The first line we see here is a WordPress function get_header, which brings in the header page.
00:40Then after that, there is a div with an id of contentWrap that holds all of the content
00:45for that main area.
00:46So, we also have another div within it for content, and then here's a section with a
00:53series of PHP code blocks.
00:56This is what's known in WordPress as The Loop, capital T, capital L.
00:59It's a very important aspect of WordPress and much of the work in WordPress has to do with the loop.
01:06In this case, what we want to do is go actually right above the loop and put in our static
01:12content, which is an h1 tag, with the text Roux Academy Blog.
01:20And let me close off the tag using code completion by putting in an angle bracket and then a forward slash.
01:27Now this will appear on all of our pages that rely on the index page, which will be a good number of them.
01:33Now, you might recall from earlier lessons the difference between working with styles.css
01:39pages and other PHP pages, and that you always have to save it in order to see the changes.
01:44So, I'm going to go ahead and save this page, and then go to Design view, and hit Refresh.
01:49There is our new h1 tag.
01:52But it needs quite a bit of styling as we see here.
01:56So, let's use our Inspect mode, go to just that one tag.
02:00I'll click once to lock it down, and it looks like we have article h1 rule.
02:06Let's go to the code.
02:09And this time, I'm just going to copy the whole thing, article h1.
02:12Now, that's copied, let's go back. We want to go into our Roux style sheet.
02:17I'll go down to the bottom here.
02:19Since this is in the content area, I'm going to put it in between the content rule, and
02:23the widget area rule. So I'll paste that in.
02:27And instead of article, let's change article for #content.
02:33So that should style it.
02:35Let's refresh the page and see how we do. All right, looking good.
02:39Working our way down the page, we come to the post headings next.
02:42And more specifically, the link states for these headings.
02:46In WordPress, it's a standard practice for post titles to link to a single page for just that post.
02:52So, let's grab the basic CSS rules for anchor tags, and there are take from the comp and
02:57paste them into the theme.css. The anchor tags are found pretty early on.
03:04I did a little investigation earlier, and I happen to know that they are on line 97.
03:09So, Dreamweaver has a handy tool for going to specific lines, and you can find that under Edit > Go to Line.
03:18It will bring up a small dialog box, and I'll put in 97 there.
03:23So, here's my anchor tag as well as a hover state rule.
03:26So I'm going to go ahead and select those two. Let's copy them and head on over to style.css.
03:33I'm going to place these because they're pretty important and they kind of rule over much of the site.
03:39I'm going to put them up near the top here after the body tag.
03:43I'll paste those in.
03:45And again, we don't need this path correction here, so I'll remove that.
03:49Now, let's refresh and see what happens.
03:52Well, it looks like we're not quite there because at this point, we've got a color:
03:57white that is taking effect.
04:00So it's going to have to be something else that overrides that and changes the color.
04:04This color: white is probably used also, it is used over here.
04:08We can see that, that's the case.
04:10So it's worked for the sidebar, and there's our little diagonal rule there. That looks good.
04:16But the main area, the area that is in the blog_comp that is defined by the article tag,
04:22has a different kind of hovering state. So let me just click on here.
04:28And when I do that, I can see the article a:hover appears. That's perfect.
04:33That's what exactly what we're looking for. And above it is article just article a.
04:37So, let's go to code using that, and pick up those two rules.
04:45And you can see that it changes the color there.
04:48So, we're going to put that right next to our other anchor tag rules.
04:53Let's hit Refresh again.
04:55Now, we have our blue anchor complete with the yellow hover state, and it's very faint.
05:01There's not a whole lot of contrast that we see here against the white.
05:05But it is there, you can see the diagonal pattern.
05:07So that's working well.
05:09With the main content area styled, you're ready to make any necessary changes to the
05:14actual WordPress postcode.
Collapse this transcript
Managing the content code
00:00Our main content area is styled correctly, but the code output needs work.
00:05If we compare this basic blog post that we see here to a comp basic blog post--I'll scroll
00:13down so we can see one.
00:15Let's just use this first Most recent post, that's very clear.
00:18So there's our heading, our body text, and comments, and then a Posted in whatever the category is.
00:26And now if we look at what we have already, well we have our title.
00:28Now we have a little additional information posted on a certain date by whomever, that
00:34we don't need to do. So, let's get rid of that.
00:38And then, down here it has kind of a reverse, the Posted in Uncategorized category and No Comments.
00:45So, we need to switch those. All right. So we've got a little bit of work to do.
00:48For this, let's go into index.php, and I'm going to open it up completely into Code view.
00:55So we can take a look at the whole thing.
00:58Let's contract this so we get a little bit clear view.
01:00As I said before, we're mostly going to be working in what is called the loop.
01:05And here you can see this h2 tag here holds in the title so that's good.
01:11But the next section, this meta section has that posted on, and it gives the date and
01:17time as well as the author. We don't want that according to our comp.
01:21So let's get rid of it.
01:22The next section is the actual meat in the sandwich, it's the content.
01:26So, we're going to leave that there.
01:28And then the following div is this one called postmetadata, and this has some of the information
01:36we want, others, we don't.
01:38I see, even though it didn't show up on our design because we didn't assign any tags,
01:42there is a bit of tag code here that's not in our comp.
01:45So, let's delete that entire line, and now it comes time to reorganize what is posted where.
01:52So, I want my comments first. So, I'm going to just grab this line.
01:58In fact, let's just grab the whole two lines, and then drag it up so that it's above the
02:04Posted in category, and there's a little separator here.
02:09I'm going to copy that, and paste it in. All right.
02:14Let's save our index.php page.
02:16Go to Design view and hit Refresh, and see how things are looking. All right.
02:20So we got rid of the unwanted extra content up here, and we do have our comments.
02:26We do have a little odd character that you see here, this double angle bracket.
02:31So let's go in, and take a look at the code one more time, so we can get rid of that.
02:35And that double angle bracket is this character entity that you see here that is the »
02:43so let's remove that wherever we find it, and there are three different places.
02:50This little comments function that you see here comments_popup_link actually is very clever.
02:55If there are zero comments, you see the text No Comments, if there is just one, it will
03:00show 1 Comment, and if there's more than one, it will show however many comments there are,
03:04that's that little variable sign there, and then the word Comments. So, very neat.
03:08So it covers all the bases. Okay? Save the page, Design and Refresh.
03:16Our little unwanted character is now gone.
03:19Now, the only other thing that I spot as I look at this, and I need to scroll the page
03:24a little bit just to make sure is it seems pretty close to me between where one post
03:30ends and another post begins. And let's take a look at the comp. And yeah.
03:33There is a big gap here.
03:35Let's use our Inspect mode to figure out where that is.
03:37So, I'm going to go here, and go down, and that's where it is.
03:42So, I'll go ahead and click once to turn off my Inspect mode.
03:47We'll expand the style sheet, and it's pointing right to main content post with these properties.
03:52Let's go to code, and I'll just select that, head back to my Roux style sheet.
04:01Now, instead of main content within the section, we're using an article tag to surround all the posts.
04:10So, I'm going to go ahead and put that in, and there's one more wrinkle, the post class
04:15is actually attached to the article tag.
04:18So, you need to remove that extra space that you see here so that it is all one solid selector.
04:25Let's save the page, and then hit Refresh. And there is our additional space. All right.
04:37As you've seen in this lesson, it takes a combination of CSS and PHP adjustment to customize
04:43your theme's main content area. Now, you're ready to take on the sidebar.
Collapse this transcript
Customizing the sidebar
00:00Let's continue our conversion of the default theme by working in the sidebar areas.
00:06Almost all WordPress themes use sidebars either on the left or the right and sometimes both.
00:12In the previous lesson changing the main content, we moved the sidebar that was on the left
00:17side of the Custom Theme to the right side as called for by our comp.
00:22In this lesson we will clean up the content of the sidebar as well as its styling.
00:27First, let's tackle the content, which is comprised of a series of widgets.
00:31You can think of a widget as a canned bit of coding that outputs a targeted slice of
00:37content often a series of links in a list.
00:40So in our blog_comp, which I have on the screen now, we see four such widgets, there is Search,
00:47Hot Links, Archive, and Categories.
00:51Now when we take a look at the current state of our index.php page I've got Recent Post,
00:58Recent Comments, Archives, Categories, and something called Meta as well as a search field up top.
01:03So there are a good number of unwanted widgets here to remove them you'll need to go to the
01:08WordPress Admin area and work in the Widget section there.
01:13So let's head on over to the dashboard, and I'll choose Appearance > Widgets.
01:19On the right-hand side under Available Widget you see a collection of standard widgets that
01:24you can bring in to any sidebar.
01:27I should mention that you can also download custom widgets.
01:31There are tons available.
01:33And we will explore little bit of that world a little on in the course.
01:36On the right-hand side are your sidebars are widget areas.
01:40Well, the custom theme, that we've been customizing, has one sidebar area for widgets.
01:47Other themes can have multiple widget areas and the widgets that you see in the sidebar
01:51widget area correspond to those widgets we saw in our Index page.
01:56So let's remove the ones that we don't need and to remove something all you have to do is drag it out.
02:01So I don't want this Recent Post so I am just going to drag that away.
02:06Same thing with Recent Comments and Meta, which we don't need.
02:12Now there is no saving or anything like that. Once you drag it out it's gone.
02:16Let's go back to Dreamweaver, and I'll refresh the page and our widget area has been greatly reduced.
02:23It looks good.
02:25Now let's go back to WordPress, and we can start to customize our remaining widgets.
02:30Now each of these widgets can be expanded and depending on the widget itself you'll
02:35find one or more options available. Search has an option for a Title.
02:40There currently isn't one in our index.php file, but if we take a look at the blog_comp,
02:46and I will scroll up, it has a very handy title called Search.
02:52So back to the Dashboard, and let's add in Search, click Save, and you can click Close,
02:59or you could click a little widget.
03:01Let's continue with our modifications before we go back and double-check this in Dreamweaver.
03:06So the next widget on our comp is called hotlinks, which as I've mentioned before is a collection of pages.
03:12WordPress has a terrific feature that allows you to quickly set up a custom menu and output
03:17that menu as a list of links.
03:19So let's create a custom menu first and then we'll add it for sidebar.
03:24So I have the widget here Custom menu, and I am going to go ahead drag it right in and
03:29place it in between Search and Archives.
03:32You will notice that when I do that it says it hasn't found any menus, and it gives us
03:37a link for creating some. That's great. Let's go ahead and click Create Some.
03:41That will take us over to the menu section, which if you need to find it again is located under Appearance.
03:48So now I can go ahead and follow the prompts here and go ahead click Create menu.
03:53So let's add in a name.
03:54I am going to call this sidebar and choose Create menu, and let's scroll down a little bit here.
04:02Now over on the left-hand side we have the ability to add in menu items, and we can either
04:08work from custom links that you see in the first widget up here, Pages or Categories.
04:15I am going to choose to work with our existing page first just to create our first menu item.
04:20So I'll select that and then choose Add to menu.
04:25Now let me scroll back up and here you can see the page listed under the menu.
04:30So I click Save menu, and now we are ready to go back to Widgets under Appearances.
04:37And if I expand my custom menu I can see that I have an option for a title. That's good.
04:43We want to put that title in of hotlinks, and I have my sidebar as an option here.
04:50If there were multiple menus available to me, they would appear in the list, but there's only this one.
04:55So now let's click Save.
04:56So that's saved, and as I said we can use the little gadget to close it up.
05:01Let's head on over to Dreamweaver again.
05:03I will go to my index.php page and click Refresh, and now we have a title for search.
05:12It needs to be styled and here's our Hot Links title with the menu item Conference Schedule At-A-Glance.
05:19So everything looks as expected.
05:21We can add more pages our hot links custom navigation as we build up the side.
05:26Now we are ready to start the styling. Let's take care of the headings first.
05:31Again, let's head over to the blog_comp. So I have a big old Search and Hot Links.
05:36They are tremendously styled here.
05:38Let's find out how they are styled by using our inspect mode, and I will just go to this
05:42one area, and as I see, I don't have to go any further just hover over my search title,
05:47and I can see the rule for sectioninfo.h2.
05:51It's got a background image and white text and special font family et cetera, So let's
05:55go ahead and click once to turn off Inspect mode.
05:59Then I will right-click on the rule, Go to Code, and let's grab this particular, all
06:06these particular rules here.
06:08I am going to copy just the properties, because I know that it goes into a slightly different
06:14selector over my index.php page.
06:18So let's use our Inspect mode to find out what that is.
06:22I will just go to the Hot Links one here.
06:25There's no rule set up for this, but if I look down at the tag selector at the bottom of
06:29the page, I can see this is not h2 tag, but an h3 tag, and that's very common in setting
06:34up WordPress widgets.
06:35They tend to use h3 tags for titles. That is located within a div of a Widget area.
06:43So I am going to create a selector that targets the h3 tags in Widget areas and paste in those properties.
06:51Let's narrow down the files that we have here so we are just working with Custom Filter.
06:56Again, we are going to choose style.css.
07:00Now we don't need to put in sidebar.php, because there's nothing structural we have to do to work with that.
07:06So let's just go ahead and click OK.
07:09There is our two stylesheets, and we want to work with the one that's in the new Roux theme folder.
07:14So I'll select that.
07:17And let's go down to the bottom. There's my Widget area, perfect.
07:20We are ready to put in our widget-area h3 selector, our curly braces, and let's paste
07:31our properties right there.
07:33Now again we have to adjust the path here to get rid of the going up a level.
07:39Now we will refresh the page and go to Design view, and now things are looking pretty good for our titles.
07:47Let's skip over search for the moment and take care of the bulk of the widgets, which
07:51output unordered list.
07:53Again, we will get the rules from the blog_comp and bring them over to Roux theme style.css file.
08:00So from the blog_comp I want to take a look at using Inspect mode.
08:09Let's start with the list items and crawl up the DOM using the left arrow key.
08:14So I will click once to go up to the ul li tag, and it looks like I've got a blogPage
08:20aside ul li rule that looks pertinent. Let's go up again.
08:24There is the same type selector targeting the ul tag.
08:28So that's definitely what we want.
08:29So I am going to go ahead and click once to turn off Inspect mode and right-click on that
08:35rule to go to code. Now let's see what we got here.
08:39I am going to go ahead and expand Code view so we can just concentrate on that and then
08:44I will press my Arrow keys so I can get back to where I was.
08:49So it looks like we've got blogPage aside ul, and that's the start of it.
08:53So let's go ahead and grab these rules.
08:55I am going to grab the a tags as well as the links and visited and then there is a hover state.
09:03So all of that seems pertinent.
09:05I am going to go ahead and copy all those rules bring that over to our stylesheet.
09:11Again, let's just go to Code view to expand everything, and now I am going to go ahead
09:16and paste all of them in and scroll back up a little bit.
09:20Now instead of blog page I want primary selector to be widget area.
09:25So I am going to copy that.
09:27And just there is a few rules I could use a Find and Replace, but let's just do this pretty quickly.
09:33I have copied it, and I am just using my Command+V to paste in these five or six rules to correct them.
09:43Now once that's done I'll save the page.
09:46Let's head back to Design view and click Refresh and see what's happening.
09:50All right, things are looking much neater.
09:53Again now if I rollover it, I see that I have my rules working out.
09:59Now something looks a little bit off. Let's go back and see there is the culprit.
10:04Here is a path that I didn't catch before. So let's get rid of that upgrade path there.
10:10Let's see if there is anything else. Nope, I think that's good.
10:15Again, I'll save, go to Design view and things are looking.
10:21Here is my background pattern coming up on hover. Great.
10:25So my final three widgets are in great shape, including the hover states, and now you're
10:29ready to customize the Search widget.
Collapse this transcript
Styling search
00:00In this lesson we are going to keep the focus on one specific widget, the Search widget.
00:05If we take a look at what we have now in index.php, we have a label Search for an input field,
00:13that's plain and white, and a Search button that needs some styling love.
00:17Now let's compare it to what we have in the blog_comp.
00:20Well, there's no label, the title is actually acting as a label, the input field is much
00:28larger, there is a different background color, and there is what is known as placeholder
00:32text, an HTML5 attribute by the way, and the phrase Enter keyword that you see in the
00:39center of the input text.
00:41But also notice what you don't see. There's no Submit button of any kind.
00:45Now I purposely included this in the lesson, because this is a situation I've encountered
00:50before where there might be something in the design that's not quite right.
00:55Rather than slavishly copy the comp when you know something should be there that's not,
01:01you often need to move ahead and put in the missing element.
01:05So what we are going to do is to bring in an image that will use as the background for our Submit button.
01:11Let's go get that now and put it in place before we start with the coding in Dreamweaver.
01:17And there is the search.png button I was talking about.
01:21Let's copy that, and now I'm going to go down to my blog folder and drill down into content >
01:31themes > roux themes > images and then paste that there.
01:40So let's head back to Dreamweaver now, and let's use Inspect mode to locate the CSS rules
01:45for the Search field. So we are in Live view.
01:48I will turn on Inspect and just hover right over that, and we are going right to it, because
01:53this is a very specific thing.
01:55So once we have it I will click once to disable Inspect mode and then right-click on my rule
02:00and choose Go to Code. So it look like have a couple of rules here.
02:05The first rule works for all input types, input type text, email, and search as well
02:12as text areas, and that sets up some of the rules.
02:16Then there's another one that's a specific for search.
02:19So let's copy both of these and then head on over to index.php, and we will open up
02:29our Roux stylesheet and paste those in.
02:33Now I'm probably going to have to change the selectors somewhat.
02:37But you might have to do a little digging to find out exactly what it is that you want
02:41to change and select.
02:42I know that I don't need the text area and select elements here, so I can get rid of
02:48those, but for the rest of we are going to need to go into Live Code in order to locate
02:54exactly what it is we are looking for.
02:56So I am going to click on Live Code and then scroll over in the Design view a little bit
03:01and just click right into the Input field.
03:06That will show us the generated output that WordPress puts together and what I immediately
03:12see is that this input, which has a type of text and not a search.
03:17And that's because WordPress has not upgraded to HTML5 form elements yet.
03:22So you won't see type = search or type = email. You will see type = text most of the time.
03:31The identifier is the id = S, and that's used on any search field that you find in WordPress.
03:38So we are going to change our selector to a id of S.
03:42Let's turn off Live Code and go to our stylesheet.
03:47So I am going to make all of these inputs, and let's just bring these properties up,
03:57because that's specific for the search, get rid of this unnecessary rule now, and it looks
04:02like I have a couple of ones that are conflicting here.
04:05So let's get rid of the width from the more generic input styling and everything else we can leave.
04:12So I'll hit Refresh here and see how things are looking.
04:15Well, things are looking pretty good.
04:17So the next thing I am going to do is create a CSS rule for the Search form button that
04:23we'll add, and because I want to target this particular search area and not in the other
04:30general search fields, I'm going to, again, use Live Code.
04:36Click into this area and see what the name of the form is.
04:40Here it has an id of search form. Perfect. That will help us target this exactly.
04:46So let's turn off Live Code, go back to style.css, enter in that id, and then we want to target
04:56the input button with a type = submit.
05:03So that's an attribute selector that we can add in there.
05:06And let's add in our opening curly braces and start styling.
05:12The first thing that I want to do is bring in that search.png background image.
05:18So we'll enter in the background property, and we are looking for a URL, and that's in
05:24my _images folder, and it's called search.png. Now this image should not repeat.
05:31So we put in a no-repeat options there, and we just want to center it in its area.
05:38So I am going to use the positioning of center center.
05:42I'll put it semicolon there.
05:44Now let me go ahead and scroll down a little bit so you better view of what's going on.
05:48We don't need a border around this.
05:50You can see the search field has already been updated, and there is a bit of my image showing
05:55through, and it also shows up what I need to work on.
05:58So I see a border around the image.
06:01We don't need that. So let's get rid of it. So border: none.
06:07And if I click over here, and I see my border is gone.
06:12Let's change the width and the height.
06:14Now I happen to know this particular image is 35x35. It's a square.
06:18So let's make the width 35 pixels and height 35 also.
06:25Let's see how that looks. Things are beginning to shape up nicely.
06:33Let me go ahead and close this down so you can do a better view.
06:36So there's my rounded area.
06:38Now I notice if I am in Live view here, and I go over it the pointer should switch to
06:43a hand icon, and it's not happening.
06:47So let's specify that in my rule with cursor: pointer, and let's check it out.
06:58That's working perfectly.
06:59Now I've got just a few remaining issues with the Search widget all of them are text related.
07:05Let's tackle them in the next lesson.
Collapse this transcript
Working with search text
00:00The remaining issues that I have to work with on the Search widget are all text related.
00:06First, there is a label, Search for, that we don't need.
00:11Then there are some placeholder texts that should be in the input field that isn't.
00:16Finally, there is a mysteriously placed search term that's overlaying our graphic, which we don't want.
00:24To deal with these issues we are going to combine some basic CSS as well as some PHP functions.
00:32So let's take care of the CSS-based solution first, and that's changing the label to a display none.
00:38Now I just want to affect the label that's in the Search form.
00:42So I'm going to enter #searchform and then a space and the tag name label, with our opening
00:52and closing curly braces. Now let's set the display property to none.
00:58And if I click back in this section, refresh the page automatically for the stylesheet,
01:04we can see that the label is no longer visible.
01:08The next two issues, as I mentioned, are putting in the placeholder text in the input field
01:13and getting rid of the word Search on the button.
01:17We can combine the solution for those in one PHP function.
01:20To handle this efficiently and show you the necessary code I've created a code snippet.
01:26Let's open that now. So we are going to go to File > Open.
01:30Let's go into Code view so I can explain how the code works.
01:34You can see that there's a number of string replacement functions that are doing the primary
01:38work here in my searchform function here. Where do I get these string values to replace?
01:44Well, if we look in the index.php file, and I have Live Code already enabled here, I will
01:50just switch to Live Code here.
01:53Then let me just go ahead and click right into the input field.
01:56Here you can see the two input tags that I'm working with.
01:59The first one is my text input, and that has an id of s.
02:04The second one has an ID of searchsubmit, and this is where the value for search appears,
02:10and that's the text that's appearing over the button.
02:13So what we are going to do is take advantage of this id=s since I know that WordPress
02:19always puts that in, and we will add placeholder text next to that.
02:24So we are going to add an attribute by using the String Replacement.
02:27Here what we will do is we'll just replace value=Search to value=nothing.
02:35So that's what these two string replacement values do.
02:38The first one looks for id=s and then replaces it with id=s placeholder=Enter Keyword.
02:51Second one looks for a value=Search and then replaces it with value="".
03:01Now once we have that function declared all we need to do is to add a filter, and this
03:06is a standard WordPress function that's used for hooking in custom functions.
03:12What we are hooking it into is a WordPress function called get_search_form, and we are
03:17hooking my_search_form into that.
03:21So let's copy just the code and not the opening and closing PHP brackets.
03:27Then I want to go expand my Panels set here and then open up the Files panel where I am
03:34going to locate in the roux folder functions.php.
03:39So this is our child functions.php file, and I am going to paste in the copied code.
03:46I like to leave a little bit of room between each of the function sets so when I go back
03:50and look at it it's easier to read. So now Ctrl+V will paste it in.
03:54I will save this page, and let's head back index.php.
04:00We will go it right into Design view, and I will refresh the page.
04:04Well, we're getting really close.
04:06I now have my placeholder text, I have my Search button with the image, and no text added to it.
04:13Obviously, we've got a little bit of alignment work to do here, but that's just a tad of CSS.
04:18So what I am going to do is go back to my style.css file, and let's take a look at our
04:25image here to see what happens.
04:27It looks like it's pushing it too far to the right and my field here is too big.
04:32So let us go down to where the input s, that's the text field, and let's reduce that width by a 20 pixels.
04:42To make sure that it gets put in exactly as I have it here I am going to add an exclamation
04:47mark and then important.
04:49That will override any in-line text that WordPress happens to put in.
04:55So if I click into here that should refresh the page, and it looks like that's working perfectly.
05:02Let's handle our little Search button here which is scroll down just a little bit too far.
05:08For that let's use a negative margin top value that I'll add into my searchform input type submit.
05:16We will try a -10 value here.
05:22So now the final property I am going to need to add in is a vertical alignment property.
05:27I am going to change the vertical alignment to bottom.
05:34Let's try refreshing the page, and we are there.
05:37I will save the stylesheet, go Design view, and it looks like our header, our main content
05:44area is all good and the final remaining element is the footer.
Collapse this transcript
Integrating the footer
00:00There is just one major area left to tackle, and that's the footer.
00:04Like the other sections, you'll need to modify the CSS, HTML, and PHP. As with the other areas
00:11of the page there is a separate PHP file that controls the footer content.
00:16And since we will need to modify the code of the page, let's copy that file footer.php,
00:21from the parent theme folder to the child.
00:25So I am going to expand my Files panel and go up a little bit until I find the custom,
00:31the folder that has our parents theme, there is my footer.php file.
00:36So I am going to copy that, close custom, select roux, and paste it in with a Command+V.
00:44Let's collapse the Files panel, and now we are ready to open up our index.php file.
00:51Let me temporarily collapse my CSS Style Sheet, so I can get to that a little easier.
00:56And I will open that up, and now we can reopen styles.css.
01:02Here is the blog page index.php.
01:04I'll discover those files, use my Custom Filter so we can hone in on our specific files we
01:11are interested in, which are style.css.
01:16Put a semicolon to separate and footer.php.
01:21So let's go into Live view, and we can compare what it is that we have to work with.
01:26Let's scroll down to where the footer is and it's just a plain copyright line, not a whole
01:30lot of code there at all.
01:32Whereas on the blog_comp, I am going to scroll down, we have a tremendous amount of code,
01:38looks like 25 or so different links.
01:41As we can say, as I go over each of those, these are all links here.
01:44That's fine, the easiest way to handle a situation like this is to copy all the content and bring
01:49it directly into footer.php.
01:51So I am going to go into Code, choose my Source Code.
01:56And then let's go down to the footer area, which looks like it starts about here.
02:03And I am going to choose everything that's within the footer tag, copy it, and head over to index.php.
02:12This time I will of select footer.php, and you can see I have a similar sort of footer tag here.
02:19So I am just going to highlight the content in that, it's just one line and delete it
02:24and then use Command+V to paste in my copied content.
02:28Okay let's save the page, and let's make sure that all that content came in.
02:33So I'll refresh Live view. And let's scroll down to the footer.
02:40And I can't quite see all of it, well it looks like the links are there, however, we need
02:47some serious styling, and we will get to that in just a moment.
02:51More concern to me at this point is if I look at the code, so as I mentioned, I have got
02:55a whole series of links here, looks like about 25 in all.
03:02And if we leave them as they are, they are not going to work correctly.
03:05So if you remember, we introduced a special PHP routine, way back in the handling the
03:11header lesson, and that's going to be a perfect fit here.
03:14To handle this many links, let's break out our Dreamweaver Power tool, Find and Replace.
03:22So I will go to Find and Replace, choose Find in Current Document.
03:27Since there is no other links in this document, this is a safe thing to do.
03:32And I'm going to look for a href = and then my opening double quote, and let's copy
03:39that so I have that starting point, paste that in the Replace field.
03:44And now I want to add in my PHP code, which starts with a PHP opening bracket and then
03:50echo siteRoot open and close braces, open and close quotes.
03:56And in the middle the argument we are passing, which is the name of the folder, blog.
04:02And then let's close that off with a semicolon and close the PHP code block with a question
04:08mark, angle bracket.
04:09All right, so we have the PHP opening code block, echo, siteRoot, blog.
04:16Let's use Replace All and looks like 27 different items were replaced and here you can see,
04:23for example, on line 10, the PHP code comes in ahead of board.htm.
04:31So let's save those changes and then I am going to right-click on this tab group titlebar
04:36here and choose Close Tab Group, so we can recover some of our screen real estate.
04:41And let's take a look at what we have in Design view, I will click Refresh.
04:46Let's go down, and now the links are still there as I said, however, they do need a tremendous amount of styling.
04:55Luckily, there's a full footer section in the blog_comp that we can bring over, pretty much intact.
05:01So let's head over there, I will go to main.css, and we will find the footer styles, which are
05:11starting around line 629, and I am going to copy all of these.
05:19Go to index.php my stylesheet, scroll down to the very bottom, make a little extra line
05:26there and paste them in.
05:28Okay let's refresh the page and see what happens.
05:32Well, things are definitely better, we can see our links, and it looks like we have a
05:38little bit more adjustments to make, but at least we are moving down the right path.
05:42Now let's see, what's missing here obviously is the yellow background color.
05:46So let's head over to the blog_comp, I will go into Split view and go into Inspect mode,
05:53scroll down to the footer area, and let's see if we can uncover that.
05:57So I do some hovering over some contact, and I'm going to go up the DOM using my left arrow key.
06:03And here we see that in the page footer rule that you see on the CSS Styles panel, there
06:09is a background color, so let's go to that rule.
06:14And I can say that it's actually one of the styles I copied, but what's problematic is
06:19that I don't have this id in my footer rule.
06:23So sometimes it's easier to change the HTML than it is the CSS.
06:28So let's go back to index.php, the footer tag, and I am going to go all the way to the top
06:33and just add in that id.
06:37Okay we will save this page and then refresh the screen, and that's worked out pretty well.
06:46We now have our three columns and the yellow background, so I have a few remaining things
06:52to take care of, and this is the last technique that I want to pass on to you, as you are
06:58doing these types of conversions, sometimes it's more efficient to just go ahead and add
07:04the rules in yourself, rather than trying to figure out what it was that they did in the comp.
07:10So let's go to style.css I am going to go into Split view and the first thing I want
07:16to tackle is the border that you see across the top here, that's not something that we
07:23want in this particular design.
07:25So I am going to go to pageFooter rule, and let's put in a new rule for a border-top and set that to none.
07:35Next let's take care of the centering that's occurring here, and we want it to be left aligned.
07:40So that's an easy fix, add in a text align property, and set it to left.
07:48So let me click into here to see how things are working, and we are looking pretty good.
07:51Now one last check against the blog_comp, one thing that I notice as I go back and forth
07:58between the two is that it seems I'm using the right fonts and everything, but things
08:03are a little smaller than they should be.
08:06So, most likely what's happening is that things have somehow gotten reduced, they are proportional,
08:12but they're not the right size.
08:14So what I would do in that case is set the font size for the footer to 100%.
08:24And let's click over, and well, that seems I have done it.
08:26Let's compare Design view to Design view.
08:31And while they look pretty good it does look like my headers are a bit off here, it doesn't
08:36actually seem like it's picking up the special web font that I'm using for headers.
08:43So let's Inspect that particular font there.
08:48And here is the h3, and I can see that it's the font-family of Bitter, and that's what I am expecting.
08:57So I can see this is a footer3 issue.
09:00So let me go back into index.php, and I will open up style.css, here is my footer h3 rule.
09:09Let's set the font-weight to normal, since it seems like it's making it a little bit
09:15bolder than it should be.
09:17Well, that seems to have done the trick.
09:20So here is our index.php file, and there is our blog_comp.
09:27All right, I think we are in great shape, congrats on completing a major conversion project.
09:32With the techniques we have used throughout the lessons in this chapter, you can re-create
09:35pretty much any static design as a WordPress blog page.
Collapse this transcript
6. Providing Responsive Design
Setting up media queries
00:00Everyday more and more people visit websites through what used to be alternative devices,
00:06tablets and phones.
00:08Responsive Web Design is a powerful strategy to handle the problems brought by multiple screen output.
00:13In this chapter I'll show you how to set up a major responsive web design component,
00:19Media Queries, for your WordPress blog site, for both tablet and phone size screens.
00:26This lesson will focus on establishing the media queries properly, as well as a vital Meta tag.
00:33Now before we go any further, I want to show you the power of media queries.
00:37So here we are in the blog_comp, and it's showing at a full Desktop size screen.
00:43Dreamweaver has some very nice capabilities for quickly shifting to other size screens.
00:48Here we see three icons, one is the tablet size that we are going to be working with.
00:53So let's go to that and here you see kind of a mini version--the portrait view if you will--of a tablet.
00:59And you notice that there was a major change between this and the full-size, mostly it
01:04was the content here on the left-hand side which got resized down.
01:09And as we scroll down, you can see that the footer was definitely affected.
01:13Smart phone size screens bring in even more radical design choice.
01:18So for that we will go to the Window Size list that we see here and choose 320x480 smart phone.
01:25And now you see a completely redesigned page that is linearized, it's all in one column,
01:30and as I scroll down pass the completely reshaped navigation and missing header graphic, we
01:36can see everything is in one column it's very readable, but it's all in one column and then
01:41there's a sidebar that follows and a link follows the sidebar.
01:45Now Dreamweaver has a number of ways to automatically create media queries that were used to create these results.
01:51But unfortunately, none of them are very helpful under these specific circumstances that we are working with.
01:57Luckily, coding media queries by hand is pretty straightforward.
02:01So I am going to close out my blog_comp, we won't be needing that anymore at the moment.
02:04So I'm here in index.php, and I've used my Custom Filter to narrow the dynamically related
02:11files just the ones we will need, which are style.css and header.php.
02:15Next, I'll switch to my roux child theme style.css, and then go to the end of the page.
02:22Let's put in about simplest of the media queries to handle our smallest screens.
02:25I am going to put in a little comment so that I know that I'm working with the phone, and
02:30we will start this rule with a @media restricted to screen.
02:39And then start our media query, so after keyword and, open parenthesis max-width: and then
02:48the value of the maximum width that we are going to be working with, and that's 320px.
02:56Close the parenthesis, put in a curly brace, put in a couple of lines, and a closing curly brace.
03:06So that's a media query for the phone.
03:09Now let's do one for the tablet, this one will be for a midsize screen, and we will
03:14incorporate one more condition, the minimum width, to set up a range of values for the screen width.
03:21So again I am going to do a comment and again, @media screen and (min-width:, and we want
03:33this to be just one pixel higher than what our phone's maximum width was.
03:39So 321 pixels, close the parenthesis and then put in another and, and a space.
03:47Open parenthesis and put on our other condition.
03:50This is another max-width. And we are going to set that to 768 pixels.
03:57Again, we will put in an opening curly brace, a line, and then a closing curly brace.
04:04So let's save the page. And I am going to stop here.
04:08And we will work with these two media queries and the other lessons in this chapter.
04:14You could, and probably should, for a final version of the website you are pushing live,
04:20include additional media queries to handle a wider variety of screens.
04:25With other media query parameters, you can style your sites for specific orientations
04:30and even higher display resolutions, like Apple's Retina Display.
04:34For details on how to set up those media queries, check out my lynda.com online training library
04:40course, Responsive Design with Dreamweaver CS6.
04:45We've got one more bit of structure to handle, and appropriately enough, it involves a Meta tag.
04:51This Meta tag uses the viewport identifier and prohibits the device from automatically
04:56scaling down the site so that the Desktop version is reproduced on a smaller screen,
05:02which we don't want, because we will be developing custom styles for those screens.
05:06We are essentially telling the device, we got this.
05:10For this bit of code, we need to access our header section found in header.php.
05:16So I have selected header.php, and let's go into Code view.
05:20I am going to scroll down just a little bit.
05:23I am going to put my cursor right after the link with the relative pingback and add in
05:31our Meta tag, and this is meta with an attribute of name.
05:36And the name we are going to pull in is viewport. Dreamweaver's code hints are up-to-date here,
05:41so you can just type a v, and then hit Return, and it will fill in the rest and the content
05:46attribute takes the initial scale-- initial-scale I should say-- = 1.0.
05:56And then close off the Meta tag, slash and an angle bracket.
06:00Okay, I'll save the page, and we are all set.
06:03Now you're ready to go after the specific CSS rules to give a custom look and feel for
06:08our WordPress blog sites, on both tablets and phones.
Collapse this transcript
Customizing for tablets
00:00In this lesson I'll show you how to retrofit a Desktop design for a tablet-size screen,
00:06specifically one that is between 321 pixels and 768 pixels wide.
00:13Let me show you what we're going to do for the blog_comp first.
00:16So I have my full-size Desktop size screen now.
00:20Let's go to Tablet size, and there is lot of differences here, some of them more subtle than others.
00:26The first thing is that the navigation is a little bit tighter in order to fit in this
00:30area, and also you can see if you look carefully that the navigation overlay--that's this brown
00:36area here--actually ends before the edge of the screen, so we'll need to adjust that as well.
00:42Next--and perhaps most visually important-- the main content area is much narrower than
00:48it was before, whereas the sidebar is exactly the same width.
00:52Now this is obviously a design choice. You may opt to reduce both the main content and sidebar proportionally.
00:59And then as we look down further, it looks like there is some changes that will need
01:02to be made to the footer. All right, so let's head on over to index.php.
01:08Now, instead of copying the values from the blog_comp and changing the selectors where
01:13appropriate, let's just work our way down the page in our WordPress blog, adding styles
01:18to the tablet media query we established in the setting up media query's lesson.
01:23For that I'll use the index.php from the blog folder, in Live view with my related files
01:29discovered, and my custom filter set to style.css.
01:34Now, again, I am going to use Dreamweaver's Window sizing capabilities to work within
01:38the targeted tablet width.
01:40Although the icons we see here are really intended for use with Dreamweaver's Fluid
01:44Grid Layout future, the tablet one is the exact width we need, so let's click that.
01:50Now you can see immediately the problems where I have a horizontal scroll bar here and one
01:55of the primary goals in making this type of conversion is to make sure that there is no
01:59horizontal scrollbar, that's it's only a vertical scroll.
02:03So first, we go to my stylesheet, and we're going to be working in the Tablet media query right here.
02:10So I am going to first reduce the overall width of the page and the main container.
02:14So we'll set the body and the outerWrapper, we'll create a rule for that and set that
02:21width to 768 pixels.
02:24Now let me go ahead and make a little more room for my design here, so we can take a
02:29look at it as it happens.
02:33Now as I mentioned, the navigation here is pushing out my horizontal. I see alumni up
02:38there, and then there is blog and about, and that means that there's just too much right margin here.
02:44So let's adjust that with another rule, and I am going to target pageHeader li, that's
02:52the list item, and I'll set that with a margin-right to 25 pixels.
02:59If you have any question as to whether you're targeting the right element or not, you can
03:04always use Inspect mode to verify what you think is right.
03:08Next, I am going to reduce the width of the navigation area which is contained in the nav tag.
03:14So pageHeader, nav, and I am going to reduce that to a width of 600.
03:20All right, let's switch in to Design view and hit Refresh and see how things are looking.
03:26Well, not bad. Looks like our header area is shaping up pretty well.
03:31Everything is kind of nicely tightened up along the navigation area, and our brown area
03:35is no longer pushing out beyond the page.
03:39Now obviously, there is the main content area next.
03:42So I'll need to adjust the background image that creates the faux columns for the main
03:47content and the sidebar areas.
03:50As I said, I'm planning to reduce the main content area and keep the sidebar the same.
03:55The full width of the entire page is 960 pixels, and my reduced width is 768.
04:02The difference between those two values is 192 pixels, so that means I just need to shift
04:09the background image to the left 192 pixels.
04:12I can do that via the background position property, and while I am at it, I'll also need
04:17to give the container that has that faux column image in it a new width.
04:22So let's head back to our stylesheet, and you may recall that the faux column image
04:26is applied to a div with an ID of #contentWrap.
04:31So let's target that particular div, and I am going to set up a background position as the next property
04:41and shift everything over as I said 192 pixels to the left, and to do that I'll need to use
04:48a negative value, so -192px.
04:53When you're changing one value with a background position, you always want to give both the values.
04:57So I want to give the horizontal version and the vertical and the vertical is just going to be top.
05:03Okay, as I said, we also want to restrict #contentWrap to a new width, and that width is 768 pixels.
05:11So let's make sure to put in our closing bracket here.
05:13Now let's apply that same measurement difference, 192 pixels, to the width of the main content
05:19area which is controlled by the content selector.
05:23Let's expand our CSS Files panel just to see what that width currently is.
05:29So I'll go here, use my left arrow key to go up the DOM 'til I get to the content area.
05:35And my width now is 607 pixels, so subtract 192 from that, and you'll get 415, our new
05:44width for the content area for tablet-sized screens.
05:47So let's go down and add in that rule, content is the selector, I'll do an open and closing
05:52curly brace and then set the width to 415 pixels.
05:59Okay, let's see how that looks with a Refresh.
06:03Ignore that protruding video for now. We'll get to that before we're over.
06:07Let's tackle the footer area next.
06:10As you can see, the three-column arrangement just isn't working anymore.
06:14Now there are a lot of variations you could apply to this area, but let's take a simple
06:18one-column centered approach.
06:20So let's head back to Split view and style.css, and we'll add in a new rule for footer tag,
06:28and we're specifically going to target a class called col, short for column.
06:32Now I am going to turn off the floating, we don't need that anymore, so that will give
06:37us one column right after another, so float none.
06:42And there is also, as you can see, right next to ABOUT ROUX ACADEMY a border-right that appears.
06:47Let's get rid of that.
06:53And finally, let's center all of the columns, so we'll do a margin: 0 auto.
06:59Okay, let's Refresh the page, and that does what we were expecting it to, but it looks
07:06like there is a little bit of padding between the links sections and the final Copyright line, would be handy.
07:12Since this is the only <p> tag in the footer, I can go ahead and address that directly.
07:18So I'll create a rule, footer p is the selector, and set the padding-top of that to 20 pixels,
07:28and let's close off that rule with a curly brace, hit Refresh, and see how it looks.
07:33All right, that did the trick.
07:35So typically, at this point I'd say good job and offer high-fives all around.
07:42But scroll up a bit, and we have this big monster video sitting in the middle of our page.
07:48The comp doesn't really account for handling video responsively.
07:53So it's good that it came up now, rather than when the client first uses the site.
07:58Let me show you how to make a video resize as needed in a responsive web design.
08:04It'll take a couple of CSS rules and some judiciously- placed HTML, but it's really not that hard at all.
08:11So, since we're here, let's do the CSS first.
08:16So let's switch to Code view, and then I am going to scroll up. I am actually going to
08:19put this video code above both of the @media declarations so that it will be effective across the board.
08:27Now we'll need to create an initial rule for a containing element that maintains the proper
08:32padding and handles overflow correctly.
08:36And I want to call this containing element video-container.
08:45The element that is within the video container--that is the video--will in the next rule be positioned absolutely.
08:52To set that up, we need to set position: relative in the containing element, we also need to
08:57add some padding on the top and bottom.
09:00Now the bottom, we're going to set up at a percentage value, and the top we'll set to a specific value.
09:06So padding-bottom, we'll set to 56.25%. This is a value that's been worked out on the web
09:13by a number of people, and it seems to be very effective.
09:17And then a specific value for the top, and I'll make that 30 pixels.
09:22Initially, we're going to set the height to zero, and that will allow whatever is
09:27in the containing element to determine the height, and overflow must be set to hidden.
09:33All right, that's our first rule. Now we're ready to create the rule for the object within
09:38the video container.
09:40When WordPress embeds video, it typically uses an iframe.
09:44But it or other systems could also use an object or an embed tag, so we're going to make sure
09:50we cover all of our bases in a single rule.
09:53So the initial selector is still my video container class, so .video-container, and then
09:59we'll put in the selector for whatever is inside that, and the first one we'll use is
10:04the iframe, and then I'll put a comma.
10:07Next, we'll do the same thing but for object, another comma, and finally we'll do a video-container embed.
10:19I'll insert my open and closing curly braces, scroll up a tad, and as I said, we need to
10:25position this absolutely.
10:26So let's make that our first property declaration.
10:29Next, we want to tell the browser exactly where within the container we want this to
10:34be positioned, and we're going to put it at the top left corner so that's a top: 0 and left: 0.
10:43We want to set the width and the height so that they expand as much as they can within the container.
10:47So we'll set those properties to 100% each.
10:51Okay, our rules are all done. I am going to save my CSS stylesheet.
10:56Now to take advantage of these CSS rules, we'll have to add a bit of HTML to our posts
11:02that contains the video.
11:04Let's head on over to the WordPress Dashboard and edit the Video Production Project Online post.
11:09Okay, so we want to go into the HTML tab, because we're going to be adding some HTML,
11:16and I am going to put my cursor right after that first line and before the link and put
11:21in my div code, which is going to be <div class ="video-container"> and then add a new line.
11:33This is very important to do that. You want to isolate the link that you see here, and
11:38if you have an errant character like I do here, this non-breaking space, you want to get rid of that.
11:44Now let's close off the div, and we can click Update.
11:47I want to reiterate that it's vital that you have blank lines on either side of the URL.
11:53Otherwise, WordPress will just output a link, rather than an embedded video.
11:57Now that we've updated the post, let's go check it out in Dreamweaver.
12:02So now I'll click Refresh, and there is my properly scaled video.
12:09If I switch to Desktop width, the video scales up accordingly.
12:13The best thing is that this video we're scaling will also work for the iPhone screens, which we'll tackle next.
Collapse this transcript
Building smartphone layouts
00:00So far in this chapter we've set up the necessary infrastructure for handling a key component
00:05of our responsive website, media queries, and retrofitted our Desktop design to look better
00:11on our tablet in portrait orientation.
00:14Along the way, we also made video sizing responsive.
00:17In this lesson, we'll set up the rules for a more radical redesign to fit the smaller
00:23screen size for phones.
00:26To get a sense of what we're going for, let's take a look at the blog_comp in a phone size screen.
00:32Unlike the tablet screen size icon, the phone screen size icon uses a 480-pixel width.
00:40So we'll have to use our Window size menu here in order to choose a 320x480 Smart Phone.
00:48As you can see, the header area is completely reshaped, the background image is gone and
00:53the navigation is now vertical rather than horizontal.
00:57The remainder of the layout has been linearized into a single column, with the main content
01:03coming first, followed by what was previously the sidebar, and then the footer.
01:12There is a fair amount of work ahead, about dozen CSS rules in all, so let's get going.
01:17As we did with a tablet, we'll build up the CSS from scratch rather than crib from the blog_comp.
01:23So with index.php from the blog folder open, I've already discovered the related files,
01:31and by using the custom folder feature, restricted the available files to style.css.
01:37So let's switch to the roux theme style.css, and let's scroll up to the Phone media query.
01:46The first rule will reduce the overall width for both the body and the outerWrapper div to 310 pixels.
01:54Why 310 instead of 320?
01:56Well, I like to leave a little room for the inevitable vertical scrollbar, as well as
02:01giving a bit of margin, so the site isn't hugging the screen edges, which we can share
02:06evenly centering the content through a margin equals zero auto declaration.
02:12So we'll enter in our selectors of body, #outerWrapper and then put in our open and closing curly
02:23braces and the width property followed by the value of 310 pixels, and then we'll set
02:29the margin to 0 auto, which as I said will center the content.
02:36Now it's time to remove the headers background image and set up the brown color in the blogHeader.
02:43So .blogHeader, and we'll use the background property to handle both of these chores.
02:51First I'll set the color to a value I've already noted down, rgba, and within that, the values
02:58(65,64,66, and then the opacity, which I'll have at 1 so that it's fully opaque.
03:10Next we want to deal with the URL, which previously applied our faux column image, and we'll set that to none.
03:17So url parenthesis, none, close parenthesis, add a semicolon.
03:23Before we take a look and see how the things are going, let's go ahead and whip the navigation into shape.
03:28This will take four different rules working from the outside in, all of them using the pageHeader class.
03:36So pageHeader nav.
03:39We'll set that width to 160 pixels, since that starts after the logo, and we want to
03:45get rid of any background.
03:48Next, let's put in our pageHeader ul selector and here we're going to move the unordered
03:56list over to the right a little bit by putting in a margin-left property with the value of 40 pixels.
04:03That will move it past the logo. Next, pageHeader li for list item.
04:11To convert an unordered list which is normally vertical to a horizontal, we use a float-left property.
04:19We want to get rid of that, so we'll enter in float: none.
04:23And to separate the various navigation items, we previously had a margin-right value of 25
04:28or 40 pixels, let's reduce that value to 0.
04:34Finally, let's adjust the height of the pageHeader anchor tags.
04:42So we'll set the line-height property to 25, and that will tighten up the navigation quite a bit.
04:48Okay, I am going to go ahead and save my stylesheet and go into Design view.
04:53Now let's go to my Smart Phone size, and there you can see my revised header.
05:00I've gotten rid of the background image, and I've converted the unordered list navigation
05:06items from horizontal to vertical and brought them a little bit tighter.
05:10They still have a rollover effect that fits in nicely with the rest of the site.
05:15We're ready to move on to the content area, and since we're linearizing the content in
05:20sidebar, we'll toss out that faux column background and reset the width.
05:26The way this page is set up, we also need to change the width of the content area, so we
05:31can group these selectors.
05:34The selector that held the faux column background image is a content wrap, and we want to address
05:39as I said our content area as well.
05:42So with those two selectors in play, let's set the background to none and the width to
05:46310 pixels to keep that all uniform.
05:51Let's add a little padding to that content area to make it more readable now.
05:56So I'll add 16 pixels to the top and bottom and 10 pixels to left right.
06:02Next, let's downscale that really big h1 tag.
06:07It was--originally the h1 was set at 2.8 ems, we reduced that to 1.8 ems for the tablet.
06:14Now let's go down to 1.4 ems for the phone.
06:17All right, let's get a little gratification here, I'll click Refresh and then scroll this
06:22down a little bit so we can check out how our content is working.
06:27Looks like we could probably bring down the h2 tags, and everything else is looking okay.
06:36Let me see what that h2 tag is right now, so it's at 1.5 em.
06:40Yeah, we definitely don't want it bigger than the h1.
06:45So I am going to make that content h2, and we'll change that font-size to 1.2 ems, that's nicer.
07:01Time to work on the sidebar, so as we scroll down let's see where we're at now.
07:06Well, as you can see, the background color that's seen in both the tablet and desktop
07:11versions was provided by--as you recall-- a faux column background graphic,
07:16which is now gone, so we're going to need to specify that directly, and while we're at
07:21it, let's specify the same width as elsewhere.
07:23So the sidebar is contained within a class called widget-area, so widget-area, and we'll
07:31set that background color to the same purple that we see everywhere and those values are
07:39(168,88,163,1) of course, you could sample this if you wanted to, didn't know what the values were.
07:46And as I said, we also want to bring in the width, and let's make that 310 pixels.
07:52Let's Refresh the page and everything is beginning to shape up nicely.
07:56Finally, we need to address the footer, and all we need to do is adjust the padding on the footer's columns.
08:03So I'll create a new rule footer space and then the class of col for column, and we'll
08:11set that padding-left to 20 pixels.
08:18So we'll save our style.css, go to Design view, we could see the footer has shift over,
08:24and now we have a nice single column layout now for the phone, and let's go up to our
08:32tablet size and our tablet is working nicely, everything visible and in place.
08:40And if we go up to full size, that's working as well for a completely responsive WordPress blog design.
Collapse this transcript
7. Extending Editable Pages
Working with categories and posts
00:00If WordPress were just for creating blogs, we could stop the course right now, but there's
00:05so much more that WordPress can do.
00:07And much of it revolves around its use of categories.
00:10As in life, a category in WordPress is used for grouping, you can create and apply
00:15an unlimited number of categories to any or all of your posts.
00:19As you will see later in this chapter you can use WordPress categories to control the
00:23look and feel of your site pages.
00:26In this lesson we'll lay the foundation necessary to gain that control.
00:30Let's start by going into our WordPress Dashboard.
00:32If I hover over Posts, you'll see in the fly-out a sub-option called Categories.
00:38Click that and you can see on the right that we have one category cleverly named Uncategorized
00:45that serves as the initial default category.
00:47On the left is the area for adding new categories. Let's do that now.
00:52So I'll click into the Name field and name my new category Courses.
00:57Press tab, and in the slug I'll use the same name but lowercase.
01:01The slug identifier will come in very handy when we get to building custom pages using
01:07categories later in this chapter.
01:10Let's leave both Parent and Description at their default settings for now.
01:14Scroll down a tad and click Add New Category.
01:21So there is our new category, now let's go put it to use.
01:24I'm going to switch to All Posts and click on the Video Production Project Online.
01:30Over on the right, you can see my list of categories. Now that's been updated to include courses.
01:36So I'm going to clear Uncategorized and choose Courses.
01:40Let's click Update.
01:42And now I'm going to go head and create a new category so I can show you one of this
01:46feature's distinguishing characteristics,
01:48the ability to create hierarchies. So I'll click Categories and here I'll name my new
01:53category Video Production, and the Slug will have the same name but lowercase and separated
02:00by a Hyphen instead of a Space.
02:02A Hyphen is used because slugs are often used in filenames, and you can't have spaces in the filenames.
02:10So now I'm going to change Parent from None to Courses.
02:14Again, we'll leave Description blank and just click on Add New Category.
02:20Though WordPress will represent any sort of hierarchy visually, there is really no limit to the
02:25number of levels that you can use for your hierarchy, so I could have something below
02:29Video Production here, and something below that, and so on.
02:32Now you may have been wondering, what's the difference between categories and tags?
02:36You'll notice that there is a Tag option over here under Posts as well.
02:40Well, this hierarchical capability is really the key one.
02:45So now that we have our new category set up, let's assign it.
02:48And this time we'll switch to All Posts and use the Quick Edit feature, and here you can
02:53see the categories in the center.
02:55I'll keep courses listed because this is still course related and then just add Video Production.
03:02Now I'll click Update, and you can see Courses has been changed to two levels, and you can
03:08see the category entry for my post has been updated to include both Courses and Video Production.
03:14So how is this affecting our page?
03:17Let's switch back to Dreamweaver and check it out.
03:20I'm going to go ahead and just hit Refresh, so I'm in Live view.
03:22Let me scroll down to where Categories is listed, and I'll hit Refresh. Watch the categories while I do it.
03:30Now we have our new categories there, but we still have Uncategorized, which is kind of unsightly.
03:36Let's head back to the Dashboard to see how to clear that up.
03:39Now if I go to Categories, and I look over my categories there is Courses, and you can
03:45see that there is a Delete option, Video Production same thing.
03:49If I try the same thing with Uncategorized, which I want to delete, I can't, there is no Delete option.
03:56And the reason there is no Delete option is because it's the default, so we'll have to
04:00change the default to something else before we can delete Uncategorized.
04:05To do that we'll need to go to Settings > Writing, and here we see the default post category,
04:11Uncategorized, and I'm going to choose Courses instead.
04:16Let's scroll down and Save Changes.
04:20My settings are saved, so now let's head back to Categories.
04:25I should see a Delete option, and I do under Uncategorized, so I'll delete that, say OK.
04:32And before we go back to Dreamweaver, let's add one more category to handle our existing
04:37posts and also to set up our work with pages and categories.
04:42The category I am going to add is called Conference, and we'll use the same word in lowercase for the slug.
04:48No parents yet, no description, Add New Category.
04:52So let's go to our post, and we'll Quick Edit Roux Academy Art Conference and set that
05:00as the new category.
05:01Now you'll notice that Courses is selected as a category right now, and that's because
05:05we had switched the default category from uncategorized courses.
05:10All right, so let's update it and head back to Dreamweaver and see how everything is working.
05:16I'll click Refresh again, and I now have under Categories, Conference, Courses, and Video Production.
05:23Now that you understand how to manage your categories on the WordPress side, you're ready
05:27to dive into working with category-driven page templates.
Collapse this transcript
Developing category-driven pages
00:00In separate previous lessons, we covered WordPress Pages and WordPress Categories.
00:06In this lesson, I will show you how much more you can do with them when you combine their power.
00:12Let's get started.
00:13So the first step is to create an index page for a specific category.
00:19The easiest way to handle that chore is to duplicate the index.php page that's found
00:24in our Roux theme folder, and I can easily do that in Dreamweaver's File panel.
00:29Let me expand it so we can see what's going on here, and we are in the blog folder, I
00:34am going to expand wp-content and then drill down into themes, and once more I have roux already open.
00:41So I am going to go ahead and just create a duplicate of this, and you can do it with
00:46a Command+D or if you are not familiar with the keyboard shortcuts, right-click, choose
00:51Edit and then Duplicate, and Dreamweaver will make an index or whatever the file name is -copy.
00:58So I am going to rename that now to conference.php, and we will use this page template eventually
01:06for all of our conference postings.
01:07Okay, I am going to go ahead and open that up and reduce the Files panel.
01:13Now let me switch into Code view, and I need to add some code to the top to tell WordPress
01:19that this is actually a template, and what template it is, and that's going to be done
01:24within the PHP code block, and just as with the style.css we will use a /* comment, and
01:36within that we will put the key phrase template name and then a colon and the name of
01:42the template, which is going to be Conference.
01:44Let me save that page. Let's add some content specific to this page, so it distinguishes
01:49it as well as some code so that only posts in a particular category are displayed on the page.
01:56So the content is easy. We will just change Blog to Conference, and now I'll have to set up
02:02the loop in WordPress a little bit differently, so I am going to need to add in a line right
02:07above the if (have_posts()), again we will just use a PHP code block, and in that code
02:16block we will establish a new variable called cat_posts, and we are going to make that equal to a new WP_Query.
02:25So this is setting up a new object using WP_Query, and there it is in code hint, and we will
02:34follow that with an open and closed parenthesis and a closing out semicolon there, and
02:39within the parentheses we name the category. So we will put in quotes: category_name=conference.
02:52Now what is this category name that I am referring to?
02:54Well, remember when we established the category we had to give it a slug name?
02:59The conference value that I have here is that slug name.
03:03So if I wanted to do video production instead of category, I would put in video-production.
03:08Okay, we have a few more changes to make, mostly to apply this variable here, so let's
03:15go ahead and just copy cat_posts. Make sure you get the Dollar sign as well, and instead
03:20of a general if you have_posts, we want to check and see if there are any posts within
03:26this specific query that we've set up.
03:28So I am just going to paste in cat_posts, and this is for checking an array, put in
03:33a hyphen and a greater-than sign, so it looks a little bit like an arrow, and
03:38now that we have that let's copy that whole construct and add it to our while (have_posts())
03:45as well as the post.
03:47Let me shrink this down just for a moment so you can see the entire line more easily.
03:51So again what we are doing is we set up a variable cat_posts and then we append that to have_posts
03:57and while have_posts, and finally if we do have those posts, then add that to the post.
04:04Okay, we are done on the Dreamweaver side of the operation once I saved the page, which I've just done.
04:09Let's head back over to the Dashboard to create a new page so that we can use our just created template.
04:15So I will go to Pages > Add New, so I am going to name my new page Conference, press Tab
04:23to create a Permalink.
04:24I am not going to add any body content here, I am, however, going to go over to template
04:29and choose from the list my newly added conference option.
04:34Once that's done, I'll click Publish, and let's see how things are shaping up now.
04:39So will click view page, and you can see my new Roux Academy Conference H1 tag there,
04:45but it also shows up another problem that here I have my text, and it's stretching all
04:51the way across, and it's pushing down the Sidebar.
04:53Now this is likely because in the custom theme that we based Roux theme on, the parent theme,
05:00there is a rule that governs what the content should look like when the body has a class
05:05named page which represents a single page.
05:09So to solve this, let's go back to Dreamweaver, and now I'll go to index.php and click my style.css stylesheet.
05:19Make sure that's the one for the Roux folder. It is. And I am going to scroll down until
05:25I find the content rule which should be near the top, there it is, so now I am just going
05:29to add another selector to this so that we will handle that case when there is a page
05:36class added to the body tag automatically by WordPress and the other selector content.
05:44All right, so that should handle this situation.
05:47Let's go ahead and save the style.css sheet, head back to our Browser, and Refresh the page.
05:54Well, there it is looking really good now.
05:57All right, now that we have a Conference template, let's take advantage of it with our existing content.
06:03I am going to head to the Dashboard, and you will remember that we do have a page called
06:09Conference Schedule At-A-Glance.
06:11Rather than set the At-A-Glance page to the Conference template, the better approach is
06:17to convert it to a post and then apply the conference category.
06:22So I am going to open up my Conference Schedule At-A-Glance, I can remember the title, so
06:27I don't need to copy that, but I want to get all of this body copy, so I am just going
06:31to put my cursor in there and do a Command+A to select everything and then a Command+C to copy it.
06:38Now before I leave here, I am just going to change the Publish Status here from Published to Draft.
06:45That will take it off the board but keep it in our WordPress system in case we need to access it later.
06:51So I will click Update, and now let's go to Posts > Add New, we will put it in our title
06:58Conference Schedule At-A-Glance, and we will paste it in our content.
07:10Now next, we want to set the Category to Conference, and if I publish this right now, what's going
07:17to happen is this Conference Schedule At-A-Glance would become the first post because if you
07:23recall we have our posts set up to show in descending order, so the newest post will show up first.
07:31One way to work around that is to change the publication date, and you can do that right
07:35over here on the right where it says Publish immediately, and there is an Edit link, click
07:39that Edit link and here we have the option for changing the date. I am just going to
07:43go ahead and change it, let's move it back a whole month, and then click OK, now I will click Publish.
07:52Now before we check out how that's looking, we have one more thing I want to take care of, and
07:56that's the Sidebar menu.
07:58You may remember that when we first created the Sidebar, we used WordPress' built-in menu
08:02tool to create one with our only page at the time, which was Conference At-A-Glance.
08:08That was the sole entry.
08:10Now that we've moved that content to a post, let's adjust the menu and add another entry.
08:15So I am going to go down to Appearance > Menus, and here is my Sidebar menu, and as I said
08:21I do have Conference At-A-Glance here, let me extend that, and we are just going to go
08:26ahead and remove the existing one.
08:30Now let's add in our Conference page. I'll add that to the menu, save the menu.
08:37Now to add in the Conference At-A-Glance, which is a post, I am going to need to pull up its Permalink.
08:44So let's head back over to Posts for just a quick second, and we will do Conference
08:50At-A-Glance, I am going to click the Edit button and then copy the Permalink which you see here.
08:59With that copied we can go back to our menu, and we're going to add this in as a custom
09:04link, and we will give it the label of Conference Schedule At-A-Glance.
09:14Okay, click Add to menu, and I should have those two items now. Let's go ahead and click
09:21Save menu, now let's head back to Dreamweaver, and I will go into Design view, click Refresh,
09:30and here you can see my menu. Under Hot Links I now have Conference and Conference Schedule At-A-Glance.
09:37Let me enable under Live view options Follow Links Continuously, and let's see what do
09:43we have under Conference, and this will pull up the Roux Academy Conference with whatever
09:48posts that we have there.
09:49There is the first post that we assign the Conference category to and then below it is
09:53Conference Schedule At-A-Glance, and it looks like there is still a little bit of CSS work
09:58that we will need to do to take care of that unordered list.
10:02So you know what to do to handle this? You turn on Inspect mode--let me open up my CSS
10:08Styles panel--and then let's take a look at what it is that we have to work with here.
10:14I will hover over the list items and then go off the DOM a little bit.
10:18I should have a <ul> entry here. Let's go into the stylesheet, scroll down to just under
10:31the content area, so I'll put in my content selector, add a ul and a comma so we can
10:37do .page #content ul, and we will set the margin left to 20 pixels.
10:48All right, I will click over here to refresh the page, and everything is lined up again. Excellent.
10:54So let me save style.css, so I want to make sure that my Live view options are set to Follow
11:03Links Continuously, and then we can click on Conference Schedule At-A-Glance, and there
11:09is that solo post all by itself, looking okay.
11:12All right, we are in pretty good shape, but there is more that we can do to make a Category
11:17page really stand out, and we will tackle that chore in the next lesson.
Collapse this transcript
Changing headers by category
00:00In the developing category driven pages lesson you saw how to limit the posts and the content
00:06area to a specific category, but what about the other elements of the page like the header, sidebar, and footer?
00:13Can those change according to the chosen category as well?
00:16Well, the answer is you bet.
00:17In this lesson I'll show you two different techniques that work together to create custom headers by category.
00:25To illustrate these techniques, what we're going to do is swap out this background image that you see here.
00:32So to start, I'll need to create a new header file that's dedicated to the Conference category.
00:39Let's expand the Files panel here in Dreamweaver, and in my roux theme folder I'm going to select
00:45header.php, and this time I'm just going to press Command+D which will duplicate the file.
00:52With a PC you can use Ctrl+D, and now I'm going to rename header-Copy, and I'll make
01:00that header-conference instead.
01:04So let's customize our new header-conference.php file a bit.
01:09I'll open it up, close down the Files panel and switch to Code view, and what we're going
01:15to do is just add a new class to the header tag. So we have blogHeader and pageHeader so far.
01:22Let's add conferenceHeader.
01:25Now if we were working with a standard foreground image like the logo, we could just swap that out.
01:30But because it's a background image that's applied to this h1 tag here, we'll use CSS instead.
01:39So let's save our page, and now we're going to need to call the new header page, and we
01:44want to call that from conference.php.
01:48So again, I'll just expand my Files panel for a moment so we can quickly access conference.php
01:54and then collapse it.
01:55Now you'll notice that the first real PHP directive here is get_header, rather than
02:00leave it at the generic get header we're going to specify, and we'll specify conference in single quotes.
02:07Notice that we don't specify header-conference.php or something like that, it's just conference.
02:14You only need to put in the keyword and WordPress will do the rest of the work.
02:19Okay, we're ready to save this. That's the only change we need to make here.
02:24Now let's go to our style.css sheet via our index.php.
02:30Make sure that we're going to the Roux style.css sheet, and I'm going to copy blogHeader right here.
02:37The rule that's on line 59, paste it right below, and change blog to conference.
02:44Now you may recall when we first copied in the blogHeader we didn't just copy in blo_header01,
02:49we copied in blog_header01, 02, and 03.
02:53So let's just change the 01 to 02, Save the page, and now I'm going to go to Design view.
03:01Again, let's go to view option just to make sure that follow links continuously is still selected.
03:07And now if I refresh the page, I am on my Conference page already.
03:10I have a new header that's dedicated to the Conference page. So far so good.
03:17Now this is fine and dandy for the General conference page, but let's see what happens
03:22when we drill down into a single post.
03:25So I'll click on Roux Academy Art Conference, and it switches back to the general header.
03:31WordPress is now using a single.php page template.
03:37Let's copy that file into our child theme.
03:40Again, I'll expand the Files panel, and let's scroll up a little bit and then roll down
03:45into Custom where you'll see single.php. I'm going to copy that file, collapse custom,
03:53select roux, and paste it right in.
03:56Okay, we'll collapse the Files panel again, and let's open up the file that we just brought in.
04:02So here's roux, I'll go to code, and as you can see, it's from the roux theme folder.
04:09Unfortunately, we can't just use a single-conference.php file like we did a header-conference.php file.
04:18We'll need to create some code to discover which category is applied for a specific post
04:23and then serve the appropriate header, and I've got just the code to do that.
04:28Let's go to File > Open, and we'll go to our Desktop where the exercise files are, and
04:34here's Chapter 07/07_03, and there you'll see the single_header_code file, open that,
04:44and here's our PHP code block.
04:47Let me explain a little bit of what's going on with this.
04:49There is basically two different areas here.
04:52The first going from line 3 to line 7, check to see if there are posts, and if there are,
04:59it gets whatever categories that there are assigned to it.
05:03Now this is a pretty robust routine that I developed for a client once, so I decided
05:07just to use it rather than strip it down to the bare minimum.
05:12This second part of the routine that you see here actually goes through and gets whatever
05:17parent category that there is, so it gets the top level category, and we'll use that instead
05:23of multiple categories that appear.
05:25All right, so the rest of the routine goes through and looks to see what categories are being used.
05:33The very uppermost category that's being used that becomes the top parent and then it looks
05:38to see if the top parent is conference, get_header ('conference') and otherwise get_header ('archive').
05:47And this last bit of code here wp_reset_query is very important.
05:52Because we have looped through the posts, you want to make sure to reset the query so
05:58that any other times that you engage in the loop on the page it will work correctly.
06:03All right, so all we need to do is to copy our sample code, go to single.php, and I'm
06:10just going to replace this one get_header file that you see here.
06:14We'll save that code, and now let's head back over to index.php, and we're in the single
06:20mode already, so I'll just refresh, and there is my new header.
06:25So it looks like we've got our header rocking to the Conference category, and if you wanted
06:29to you could apply the same techniques to the sidebar and footer.
06:33It's all up to your design.
Collapse this transcript
8. Enhanced JavaScript with WordPress
Adding Spry accordion panels
00:00Dreamweaver has a good number of layout power tools built right in, many of which rely on
00:05the Adobe fostered framework Spry.
00:09Putting them in a standard Dreamweaver page is pretty much point and click.
00:13Adding them to a WordPress page takes a bit more work, but it's definitely doable.
00:18In this lesson, I'll show you how to add a Spry Accordion panel to a WordPress page.
00:23But first, let's create a new page template to work with.
00:27To do that, I am going to copy the index.php page.
00:31So let me expand my Files panel, and in the roux folder, I'll select index.php, and then
00:39press Command+D for duplicate.
00:42Once that's done, I'll select the index - Copy.php and rename it, and I am going to name it events.
00:50Now, let's open it up.
00:53I'll collapse the Files panel and go into Code view.
00:57Now, I need to add my template declaration header up top here.
01:01So, I'll do that starting with a PHP code block, and then my comment frame, and inside
01:09of there, Template Name: Events.
01:15So now, I'll save that page, and let's create a new page in WordPress that uses our Events template.
01:22So I'll go to Pages > Add New.
01:24I'll put in a title for this one, Homecoming is coming!
01:33And just some sample placeholder text for now, Text for homecoming event.
01:39Let's switch the Template to Events and Publish. Okay.
01:45We'll view the page, and there is our Roux Academy Blog, Homecoming is coming!
01:51Now, let's customize this a little bit more.
01:54We'll go back to Dreamweaver, and change Roux Academy Blog to Roux Academy Events. I'll save that.
02:03Once I go back to my browser and click Refresh, that update will take place immediately.
02:08You can easily go back and forth between Dreamweaver and WordPress, making changes as needed.
02:13So now we're ready to add in our Accordion panel.
02:16I am going to go into Split view here, and you'll notice that I have Invisible Elements turned on.
02:22Now, that's found under the view options, and it's very handy sometimes for quickly
02:27isolating certain code blocks, especially when you've got lots of PHP code, and you're
02:32not quite sure what is what. Rather than staring at the code, sometimes I'll go into Split
02:36view, and if I know about where the code block takes place, I can find it more easily.
02:41So, what I want to do is select the PHP code block right after Not Found.
02:47That PHP code block ends the loop within WordPress.
02:51So, we're going to go just outside that.
02:53So I am going to click my right arrow once, and move, as you can see, in Code view just
02:59to the right of the code block.
03:01And now we're ready to insert our Spry Accordion panel.
03:04So, let me double-click on the Insert Tab here. Then I will switch to Spry.
03:11You could also go to Layout if you wanted to, but sometimes Spry is easier.
03:15And I'll scroll down 'til I see Spry Accordion, and click it once to insert it.
03:20Now, let me open up my Property Inspector.
03:23It's very handy when working with Spry, especially when you're working in Split or Design view,
03:29you can really take advantage of Spry's tight integration and use the Property Inspector
03:34for a lot of different kinds of manipulation.
03:37For example, now that I have the Spry Accordion Tab selected, that will give me my custom Property Inspector.
03:45And if I want to add a third panel here, I'll just select Label 2, that's the second panel,
03:53and click the Add button. That will put a third panel right after my selection.
03:57Now, let's go ahead and change the headings.
03:59I am going to go ahead and just select the first one to open it up.
04:04I'm going to make the first heading Transportation.
04:07This Accordion panel will contain some standard content that I want to appear on every events page.
04:14So, we'll have some information about Transportation.
04:17We'll also cover Restaurants, and I'll put that label in Label 2, and Label 3 will become
04:24our Lodging category. All right. Let me save the file.
04:29When you save any file with a Spry component, Dreamweaver lets you know that it needs to
04:33copy some files to the site root. So, let's okay that.
04:38Now, I am going to go back into my Files panel, expanding that, and show you what just took place.
04:44Here is a folder just added.
04:46Let me collapse blog, so we can see better what's going on for SpryAssets.
04:51If I expand that, we'll find two files, one for the CSS and one for the JavaScript.
04:56I want to copy both of these files.
05:00So I've selected them now, and I'll press Command+C to copy them, and I am going to
05:04put them in the roux folder. Let me just scroll down.
05:07I believe it's already opened up, and there it is.
05:09I am going to go ahead and just put it in a similar folder that I'll create now by right-clicking
05:15on roux, and name it the same, SpryAssets.
05:22And with that selected, press Command+V to paste in my files.
05:26Now what we're going to do is go back to our code, where if we scroll to the top, you'll
05:35see that a script and a link tag were added, pointing to where the files were initially
05:42saved in the site root.
05:44We're going to change this path so that it points to the roux folder, SpryAssets folder.
05:51And for that, I'll use a WordPress function called bloginfo to find the stylesheet directory.
05:58So, it's a PHP code block.
06:00And within that is the function bloginfo with the parentheses and followed by a semicolon.
06:10Within the parentheses, we'll use double quotes and the key term stylesheet_directory.
06:18This will point to whatever folder is using the current theme's stylesheet which works
06:25really well when you're working with child themes as we are.
06:28Okay, I've retained a trailing slash after that. That's good.
06:33So now I can just copy this PHP code and use it to replace most of the initial path for my link tag.
06:41So, let's save that. Now, let's take a look at that in the browser.
06:45So, I am going to head back to the browser page that I had opened with Roux Academy Benefits.
06:51And if I refresh the page, I'll now see my Accordion panel has been added to the page
06:58after the text that I put in.
07:00So, I can click on Restaurants, Lodging, go back to Transportation.
07:06All seems to be working very well. Obviously, we'll need some styling.
07:10But before we get to that, let's add in some content.
07:13So I'll go back to Dreamweaver, and I have some content already prepared.
07:18It's stored within our exercise files.
07:21So I go to File > Open, go to Desktop/Exercise Files/ Chapter 8/08_01/accordion panel copy.htm.
07:36Open that up.
07:39I'll go into Split view so you can get a better sense of it.
07:43And here you can see it's divided into certain areas. The last one, Lodging, even has a few images there.
07:49So, I'll just copy this initial text here for Transportation, go to my Events page.
07:55And because I copied it from Design view, I am going to paste it in Design view.
08:00So let me highlight my Spry Accordion here. I am already in Content 1.
08:05So I can select that bit of placeholder text and paste it in my code there.
08:11Now, let's go back, and let's get the next one which is under Restaurants.
08:19This time just to do a little variety of things, I am going to go ahead and copy the text in
08:25Code view, and following my basic rule of pasting in wherever you copied from.
08:33Here is Content 2, the Restaurants, so let's paste that in.
08:37Now, I notice that when I copied in my text from above, it didn't bring in a paragraph tag.
08:44So I can quickly adjust that.
08:47I'll put my cursor right after the end here and just hit Enter once.
08:51That not only creates a new paragraph line with a non-breaking space, but it also wraps
08:57the previous text in a paragraph line. So, that's a quick little shortcut.
09:01Let me hit my Delete key to go back and get rid of that unneeded P tag. All right.
09:07Let's go ahead and get the final option which is Lodging.
09:13So, I'm going to just select the first image there to go right down to the code.
09:18Now you want to be sure to get the div that's above that image, and the h3 tags, and then
09:24scroll all the way down to the bottom here, and get the closing div as well.
09:30There is a couple of divs that are being used here to provide some in-line styles, specifically
09:36a margin bottom to separate these two.
09:39Obviously, for the final product, you would want to incorporate that into your CSS stylesheet,
09:44and not use the in-line styles, but for our purposes, it works.
09:47So, I am going to copy that, head over to events.php, and let's scroll down to where Content 3 is.
09:57I am going to click the Delete key to remove it, and now I'll paste in my other content.
10:03Now, if we take a look at this in Split view, you will notice that the paths are not coming in correctly.
10:09In fact, we need to adjust the paths so that they point to the Roux theme directory.
10:16And for that, I am going to go up and since we already have used this code block once,
10:22I am going to grab that same PHP bloginfo stylesheet_directory code block.
10:29Copy that, head back down to where the images are, and put it right in front of the first
10:37source value, paste that in.
10:40Now, we're not quite done, so the bloginfo stylesheet_directory will take us to the roux folder.
10:45Now we want to go into the _images folder.
10:47So I'll add that to my path and put another trailing slash.
10:51Now, this entire bit of code here is really the path that we want in front of the other image as well.
10:58So I am going to copy that, go down to fancy_hotel.png, and paste that in. All right.
11:04Let's save that page, and head on over to our browser, where if we refresh the page,
11:10we'll see some content added.
11:12There is my Restaurant list, and let's check out the Lodging, and there is our hotels. All right.
11:18All the content is in place, we definitely need some styling now.
11:22Let's go back to Dreamweaver, and I am going to close my Accordion panel copy file.
11:26We don't need that anymore.
11:27Now, let me go over and reduce both the Insert panel and the Files panel so we can give full
11:33focus to our CSS Styles panel.
11:36Now, one thing that I've noticed when working with Spry components, I find that it's actually
11:40easier to use the All mode of the CSS Styles panel rather than the more frequently used Current mode.
11:47Now, you'll notice right here in the events.php file, if I switch to the All mode, I have
11:53a listing for SpryAccordion.css but no style rules.
11:58That's because you cannot make modifications to just the events page.
12:03You have to go to the index.php page with all of its dynamically related files.
12:09So let's switch to that.
12:11And I don't have a events page linked from the navigation anywhere.
12:15So when you're working with your pages, the easiest way to handle it is to go back to
12:19the browser for just a second, select and copy the URL for the page you want to work
12:24with, and then head back to Dreamweaver, and insert it into the location bar and press Return or Enter.
12:31So now, I'm working with my Accordion panel right within Dreamweaver, and I have my stylesheet
12:36in All mode, and I can expand that.
12:39Let's bring the Properties down just a little bit so we can see some of the various properties there.
12:43And we're ready to crawl down the SpryAccordion.css sheet.
12:47So, the first thing I'm going to change is the color of the tab that we see here, so
12:53the AccordionPanelTab.
12:54What I want to do is instead of using this light gray background color, I am going to
12:59sample the purple that we see here. So I'll sample that.
13:03Now, notice that two of them changed, but we'll get to the one that did not change in just a second.
13:08I also want to make sure that the color is white rather than this default black.
13:13So, let's add a color property here, and I'll just type in white.
13:19Next up is the one right below that which is the AccordionPanelContent.
13:23And as you can see, the content here under the Transportation tab that's open kind of
13:29goes right up to the edge of the screen.
13:31So, that's because there is 0 padding by default.
13:33Let's make that 10 instead of 0.
13:36Next up is the next rule which handles the properties for the Accordion panel tab when
13:42the panel is actually open, and I am going to just keep it consistent.
13:46Let's make our background color the same, sample purple there, and let's go ahead and
13:51add a color: white just to be sure.
13:54Next, let's do AccordionPanelTabHover, and I am going to scroll up the page just a little
13:59bit, so I can pick up the orange here that's in the R.
14:02So I'll click into the color swatch and go over and sample that color.
14:05So, let's scroll down all the way to the ones that are close, and you can see the orange appearing there.
14:10Now, we have to do the same thing for the Open panel.
14:13So we'll scroll back up and sample that orange. All right.
14:18We are almost done, we have two more rules to do here, and that is the AccordionFocused section.
14:24So, if you notice that when I roll over and if I click on anything, once the Accordion
14:28panel has focused, it has a whole other set of colors.
14:32And we want to of course make that conform to what we've been using.
14:36So here I have my background color. I'll sample again the purple.
14:40Let's add the color property, and set that to white, and we're just going to duplicate
14:46that exact same thing for the next rule, color: white.
14:53Okay, so let's take a look.
14:54There is all the various panels seem to be working correctly and they definitely are
14:58fitting within our style.
15:00Now, there is one last style issue to address that's not related to the Spry components.
15:05If you expand the Restaurants panel as I have here, you can see the list of Restaurants
15:11is pretty bland, and honestly, it's not terribly readable.
15:15If we take a look at the code on the events.php page for that section, we can see that definition lists are used.
15:23Rather than just generically style all definition lists for the site, let me show you how to
15:28target a specific template page.
15:30So, I am going to go back to my index.php file, and let's enter into Live code.
15:35And I am going to go up to the body tag.
15:38Let me just choose on the tag selector here so it will go right below that.
15:41Now, you'll notice there are number of classes that are dynamically added by WordPress, there
15:46is page, there is page-id-55, there is page-template, and there is also a page-template-events-php.
15:54That's the exact class that we need in order to target our definition list CSS rules.
15:59So, with that selected, I'll copy it, drop out of Live code, go back to our style sheet,
16:04and I am going to add about three rules.
16:06I am going to put them down towards the bottom here.
16:08Let's put them in between the footer and the video container.
16:12So first, I'll put in a dot for the class and then paste in my selector, and we want
16:17to first style the definition list itself.
16:20And all we need to do here is just add a margin-left of 20 pixels.
16:26Next, we'll target the definition term which is the first phrase in the definition list,
16:33and let's make those stand out a bit with a font-weight of bold.
16:37Now, let's do the definition data with our same selector and set that padding so that
16:46there's some separation on the bottom and on the left. So, padding: 0 0.
16:52Let's do 15 pixels for bottom and 20 pixels for the left. Okay.
16:57I'll save all of our files.
16:59Let's go up to File > Save All Related Files to make sure we've got everything, and I'll
17:03click on Design view.
17:05And now you can see the results of our little bit of styling.
17:09Well, that looks pretty good.
17:10Now, let's head back to the Dashboard and make it easy for us to access our page by
17:15adding the homecoming page to our sidebar menu.
17:18So go to Appearance > Menus, and here is Homecoming is coming!
17:23I'll just add that to the current menu and save the menu.
17:27So now when we take a look at the page, we'll see that there, and I can click on it, and
17:32there's my Accordion panel looking pretty good.
17:35All of the techniques we used in this lesson can also be applied to Dreamweaver's other
17:39Spry layout tools, including tabbed and collapsible panels.
Collapse this transcript
Working with Spry form validation
00:00Form validation is one of the things web designers love to hate.
00:04You know you need it, your forms would be better off with it, but it can be so tricky
00:08to implement it's often left undone.
00:11Luckily spry validation is pretty straightforward to integrate into a page even on a WordPress page.
00:18Let me show you how.
00:18So I am going to start off by adding some basic form elements to our events template page.
00:24I will switch to events.php that I have opened. I am here in Split view, so I want to put
00:31this form right above the Accordion panel that we inserted in the last lesson.
00:37To do that, I am going to select the Accordion panel here. As you can see, in Split view
00:42on the left-hand side of the screen, all of that code is now highlighted and then I am
00:47going to use my left arrow key to move right in front of it but staying in Design view.
00:53All right, double-click on the Insert panel tab to open that up, and this time I am going
00:58to switch over to Forms and start to build out my form.
01:03So first let's add that Form in, and there you can see the red outline of the form, and
01:09now I want to add a field set to that, so we will scroll down to where we see Fieldset
01:14and click on that, Dreamweaver will ask what's the legend is that you want to put in, and
01:19this is going to be a small form that just tries to encourage people to sign up for the
01:25events and newsletter. So Sign Up for Our Newsletter.
01:29Now I am going to add a paragraph right after that, just a little descriptive text, and let's
01:35just put in Get all the news hot off the presses.
01:40With an Exclamation Mark of course.
01:43Next up is the actual field that I will be using for my Spry form, and this form will
01:49just have one field, and that will be an email field so that starts off as a Spry Validation Text Field.
01:56So let me click on that entry in the Insert panel and the id will be emailNewsletter,
02:03press Tab, the Label is just Email.
02:08We want to make sure to attach the label tag using the for attribute and have it come
02:12before the form item.
02:15Let's leave the other values at their default and click OK.
02:19There is my Spry TextField.
02:22Now once it's inserted, we have our custom property inspector.
02:25I am going to change the type to Email Address, and that will give us another preview state
02:33of invalid format, while that's highlighted, let's change the message a bit, and instead
02:39of a somewhat formal but totally uninformative invalid format, let's make it Full email address
02:48and add a comma and a please because we are nice.
02:52Now we also want to change the other text message, the other preview state that we have
02:56is one for required, so I am going to go ahead and instead of a value is required, let's
03:03just make that the simple word Required, with an uppercase R.
03:08Okay, so at the end of this field I am going to hit Return again and add a Submit button
03:15so that's a button here. Just going to put in an id of submit and click OK.
03:22No label is needed for such a button.
03:25Now I'll save the file, and we will go through the same steps we did when adding the Spry
03:31Accordion to the page in the previous lesson.
03:34So I will click OK, that will add the SpryAssets to the site root. Let me expand my Files
03:41panel, and now I am going to scroll down to where my SpryAssets folder is in the site
03:47root, and you will notice two new files have been added, one CSS and one JS, both dedicated
03:52to the spry validation text field.
03:55So with those selected I will copy them and then do a little scroll up to where I find
04:00the SpryAssets folder that's within the roux folder and paste those files right in there.
04:08Okay, let's collapse the Files panel, and we are going to adjust the paths, so I will
04:14go ahead and expand to Code view here, so we can go up the top of the page where Dreamweaver
04:19has inserted this code.
04:22Now since we already did this code block here at once, I am going to go ahead and select
04:26it and then copy and then replace all of the path up to the leading slash before SpryAssets,
04:34paste that in, and let's do it not only for the link tag but also for the script tag.
04:38All right, I will save our page, and now we are ready to head on over to the index.php
04:45page, where I will refresh it, and then scroll down, and there you see our form kind of jammed
04:54on top of the Spry panel, we will take care of that as we do with a little styling, let's
04:59take care of the various styles first.
05:03So again, I will collapse the Insert panel and the Files panel to give full precedence
05:09to my CSS Styles panel.
05:11Now I have these SpryAccordion.css stylesheet expanded, let's collapse that, and there is
05:16my SpryValidationTextField style sheet, so I will open that up, and we are ready to start work on this.
05:24Before we do, I just want to demonstrate a little bit about how this works, so here is
05:28the Email field. If I click into it, you can see a little active background appears.
05:35If I try to just click Submit, I do get an error message. If I put in a partial email address
05:45and click Submit, I will get a different email message.
05:49Now there are specific characteristics here, the red background is to show the error, there's
05:54also a border on the error messages, which I don't like from a design perspective so
05:58we will remove that and make some other adjustments as well.
06:01Again I am going to just work my way down the SpryValidationTextField.css, so let's
06:06just start at the very top and move down.
06:09Now the first one we are going to leave alone. This sets up the initial state for whether
06:14messages are required or not. We don't display that until it's necessary.
06:18So now we will go down, I will just press the Down Arrow key in order to move down to
06:22the next CSS rule, and as I said I am not a big fan of the border here, so I am just
06:28going to select the border and then click the Trashcan.
06:31I think red is very appropriate for an error message, so we will leave that.
06:36Let's go down to the next rule.
06:38Now this is for the ValidState input. I didn't demonstrate this but if I had put in a valid
06:43email address, we would have had this lovely green color.
06:47Again, not a big fan, so I am going to go ahead and change that to white, and let's
06:51continue down our rules. Here is a background color, that's okay. I think this light red
06:55is okay with me, so I am going to keep moving.
06:58Now here is the background color for the input state, and rather than use their version of
07:04the light green, let's work with the one we already have on our comp, so I am going to
07:08click on the Color Swatch and then sample that, and that's going to look a lot better
07:14and here is our red color, that's fine, and one more for the TextField state.
07:21I want to go through it just one more time just to make sure I got everything, looks good.
07:28So we have taken care of the Spry elements, but how about adding some style to the other
07:32form elements so it fits into our site better?
07:36The few select rules again using our page template events PHP selector as we did with
07:42the Accordion panel, we can target our CSS rules for the form.
07:48So I am going to go to style.css, and let's go right down to where we define the CSS rules
07:54for our definition list.
07:55I am just going to pick up this selector one more time here, and let's put in a new rule for the fieldset.
08:04Let's go to Code so we can see this just a tad easier.
08:08Okay, so there is my fieldset up top, I will add my opening and closing curly braces.
08:15Now I like fieldsets that have slightly rounded corners, so I am going to put in a border-radius
08:20of 5 pixels, let's separate the fieldset from the Accordion panel with a margin-bottom of 20 pixels.
08:29We are going to put a blue border around it, so we will put in border: 2 px solid,
08:38and I am going to use the same color that we've used elsewhere in the site, and that's
08:45(168,88,163) with an opacity value of 1, and finally let's add 10 pixels of padding all round.
08:56All right, let's take a quick look and see how that's shaping up.
08:59Well, I think that's working out pretty well. We are on our way. Let's now do the legend, so back to code.
09:08Paste them in my page-template selector and add the tag legend, we will make this a different
09:15color that's in our site.
09:18Now this will be a blue color, and let's make the font-weight bold. How we are doing?
09:29Much better. Okay, we need to adjust the P tag just so we can space that out a little bit, my
09:34selector and then P, and this will be just a padding property with 5 pixels top and bottom
09:44and none left and right.
09:48Next up, we want to address the two actual form elements, the text field and the Submit button.
09:55Again when we take a look at that we can see that they are little bit scrunched, so I am
09:59going to add some padding, and we will also move the Submit button over to the right,
10:05and because we have more than one form on here, we have a search form as well.
10:09I am going to target this very form, which is Dreamweaver's default of putting in form1
10:14as an id, and then we will look for the input tag with a attribute that has the type set to text.
10:26And that one we will only need a little bit of padding all around. Let's do 3 pixels of padding.
10:31Now I am going to copy this whole selector here, paste it in because the only thing we
10:36need to change now is the type value from text to submit.
10:41All right, let's put in our opening and closing curly braces, adding some padding value.
10:48Let's do again 3 pixels on the top, but I want to add 5 pixels left and right, and this
10:54will make that Submit button a little bit bigger, and as I said I want to move it to
10:59the right, we will do that with a margin-left property of 45 pixels.
11:04Okay, all that's left is to kind of save and test. There is my New button. Let's head back
11:10to the Browser so that we can do our testing in a proper environment.
11:16So my form looks good. Let's see how it acts.
11:18So if I click Submit, I get the message that the Email form is required.
11:24Now when I click into it, I can see I have the active focused background, that's the
11:30same as the search, that's great.
11:32I will just put in my name because that's all they actually need, right? And hit Submit.
11:38Again, Full email address, please.
11:41Fine, so let's go ahead and put in a full email address and then hit Submit, and it's
11:48submitted, everything is good. All right, pretty sweet.
11:52We've got Spry Form validation up and running in a WordPress page.
Collapse this transcript
Integrating jQuery functionality
00:00While there are more than a few advanced web widgets and effects that use the Spry JavaScript
00:06framework, there are thousands that use jQuery, the most popular JavaScript framework.
00:12Many WordPress widgets and plug-ins rely on jQuery, and as you'll see in the chapter using
00:17WordPress plug-ins, they are drag and drop simple to use.
00:21However, if you just want to include a little custom jQuery code, you'll need to take a few extra steps.
00:28To illustrate the process, let's draw a little attention to our Newsletter Sign Up form by
00:33making it fade in when the page first loads.
00:36In a standard Dreamweaver page, the first step for adding jQuery functionality is to
00:41include the library, either from a self-hosted file or a content delivery network, also known
00:47as a CDM, but WordPress already includes jQuery.
00:52It's actually used in the dashboard as well as a good number of other framework scripts.
00:58All you need to do is to invoke the desired framework, or as they say in WordPress speak, enqueue.
01:05Here's one way to do it.
01:08Let's open up our header.php file from the roux theme, and I'm going to put this code
01:14right above the WordPress function wp_head.
01:19This will go in its own PHP code block, and we'll use the WordPress function enqueue.
01:27Now I'm going to bring up code hint that we set up with our site-specific code hinting
01:32earlier so that I can make sure to spell enqueue correctly, which is not the easiest word.
01:38And here is what we want, enqueue_scripts. So I'm going to go to the second one here.
01:43So now before I put in jQuery in the center of those parentheses, I want to be sure to
01:47get rid of the trailing S here, because really what I'm doing is just wp_enqueue_script.
01:52So, now I'll add in my quotes and put jquery, lowercase, in there.
02:03So I'll save my header.php page. Now that jQuery's all queued up, what's next?
02:09Well, next we'll add in the specific jQuery code for whatever functionality we want to set up.
02:16The current best practice regarding JavaScript is to insert your code just before the end
02:20of the page, which in WordPress means the footer page.
02:25Now we don't want this little bit of jQuery magic we're working with to run on every page
02:30just those using the events template.
02:33So let's create a custom footer for just that page and put our jQuery code there.
02:39I'll expand the Files panel and select my footer.php page that's in the roux folder,
02:47press Command+D to duplicate it and then rename footer-copy as footer-events.
02:58Once that's renamed, I'll open it up, collapse the Files panel, let's go into Code view it
03:05make it a little bit easier, and scroll all the way down to the bottom of the page.
03:10Now I'm going to put my script tag right above the wp_footer rule, and this is a standard
03:18script tag with a type of text/javascript, and within it is the jQuery call.
03:29Now the syntax for this is a little bit different than your normal jQuery colon.
03:34I'll point out what is different.
03:35Typically, you start with a document.ready function envelope, and this will be about
03:42the same but just a slight tweak.
03:45So instead of starting with document.ready, we start with jQuery and then add the document.ready.
03:52So it's (document).ready and they we'll open a parentheses again, put in function and then
04:04another open parenthesis.
04:06Now typically, this parenthesis is left empty, but to allow the code within WordPress to
04:11recognize the dollar sign syntax that we'll be using, we put it in a dollar sign.
04:17So the two differences really are just adding jQuery to the start of this line and putting
04:22a dollar sign in your parentheses following function. All right.
04:26So let's go ahead and put our first opening curly brace here, and let's put in the first of two lines.
04:32We'll put in a dollar sign so that we can identify our selector which is going to
04:37be the fieldset tag and then encase that in quotes and also parentheses and then .css
04:45because we're going to change the CSS property, and the CSS property we are going to change
04:50is the display property.
04:52So I'll put that in quotes as well, followed by a comma and then the property we're
04:57setting it to, which is none.
04:59So basically what this is saying is when the page first loads, hide the fieldset.
05:05Now let's display it.
05:07So I'm just going to copy that first selector there, all the way up to and including the dot,
05:12and then on the next line paste it in and then we'll call a jQuery function, fadeIn,
05:21and give it a value of 2000.
05:22So that's 2 seconds and close it all out with a semicolon, and then let's close
05:29off our curly braces as well as the parentheses and the final semicolon.
05:38Okay, that's all good. We'll save this page, footer_events.php.
05:42Now we are ready to tie footer_events.php to the events template.
05:48So I'm going to go over to my events.php page, scroll down to the bottom where we have get_footer
05:55on line 84, and rather than have the generic get_footer empty parentheses, let's add in
06:03two single quotes and put in our template name which is events.
06:07Believe it or not, we are done, it's that simple.
06:12So I'll save the page, and let's run it through its paces and see how it looks.
06:17I'll go back over to Dreamweaver, go into Design view, and let me scroll down just a
06:23little bit so we see our form. I'll hit Refresh.
06:28And when the page loads, our Sign Up for Newsletter is not there and then it fades in.
06:32While it works in Dreamweaver, it's not quite as smooth as it will appear in the browser.
06:37So everything's working as expected.
06:40Of course, this is just the bare minimum of what you can do with jQuery in WordPress.
06:45Keep in mind that if you want to work with other jQuery libraries, like jQuery UI, you'll
06:50need to enqueue that script as well.
Collapse this transcript
9. Using WordPress Plugins
Understanding WordPress plugins
00:00Although WordPress is very powerful right out of the box, there is a rich landscape
00:05of plug-ins that extends its capabilities tremendously.
00:09A WordPress plug-in is very similar to a Dreamweaver extension except you don't use the Extension
00:14Manager as you do in Dreamweaver, we use the Dashboard.
00:18So let's switch over to WordPress and go to the category on the left called Plugins.
00:24Let's open that up so we can see all the Plugins that are currently installed.
00:29WordPress comes with two extensions or Plugins preinstalled: Hello Dolly, which is just
00:34kind of a fun thing that you can implement on your own WordPress site if you like, and Akismet.
00:40Now Akismet is a very powerful plug-in that performs a totally necessary service.
00:46A lot of times with blogs, you'll get comments that include a ton of spam.
00:50Akismet can greatly reduce that spam for you.
00:54So let's activate Akismet. I'll click Activate here, and I want to point out that once you
00:59activate any plug-in the options change below its name, now it says Deactivate & Edit Settings
01:06instead of Activate.
01:07You'll notice up here we have two messages, one saying Plugin is activated, but we have
01:12to enter here Akismet API key for it to work.
01:15So let's click that link, and that will take you to a new screen, that's just installed
01:20with the Akismet activation, and that allows us to enter an API key.
01:26The Akismet API key is available for anywhere from free to relatively low-cost.
01:31Visit akismet.com/wordpress to get yours.
01:36Now I already have an API key, so I'm going to paste it in here, and I'm going to go ahead
01:41and click my options here to Auto-delete spam that is submitted on post more than a month old, that's good.
01:48Showing the number of comments, I'm not so keen on having that there, so I'm not going
01:52to choose that option, and then I'll click the Update options button.
01:57I get a message indicating that the key has been verified, and I want to point out as
02:01we go, scroll down a little bit, that there's some more information here about the Akismet servers.
02:06There are four available, and they're constantly updating these.
02:10So let me point out also under the Plugins section, there is now an Akismet Configuration,
02:15which will take you to this page here.
02:17Other plug-ins will put their own panels under Settings or list them separately.
02:21Now that's a nice free plug-in that I can recommend you implement very, very quickly on your own
02:27site or on your own client-site, but there are also other plug-ins that you can add, and
02:32the way that you get to them is by going to the Add New option under Plugins.
02:37As with the themes there are numerous ways that you can search for it.
02:41We're going to look for an Event Calendar.
02:43So I'm just going to go ahead and enter a Search for those two terms, event calendar.
02:49Now I click Search Plugins. As you can see, there's a good number of event calendars available.
02:56Let's scroll down a little bit, and I'll show you the one that I have used successfully before.
02:59It's this one that just lists as Events Calendar and the author is Luke Howell.
03:04So let's go ahead and click Install Now.
03:08I'll get a request for a confirmation, I'll click OK.
03:11WordPress quickly unpacks it and installs it, and all you need to do is to activate it.
03:16Now that the events calendar has been activated, you see a listing for right here, as well
03:21as some coding information, including how to put it on your page very simply.
03:25So if you want to put a large calendar on the page, you put in this bit of code, that's
03:30in square brackets, right here.
03:33This is called a short code in WordPress Jargon.
03:36So now that I have that selected, I'm going to go ahead and copy it, and let's go over,
03:41and we'll create a new page, and we'll call this Events Calendar, and here in the body
03:48I'm just going to paste in that bit of short code I copied.
03:51So in square brackets, it's events-calendar-large.
03:56Let's use the Events Template and then click Publish.
04:01Once it's published, let's take a look at the page, and here you can see the large calendar that's been added.
04:07The calendar is showing the current month when I'm recording this lesson, and the current
04:11day has this light blue background here. Now you can see it's very functional.
04:16If I click on the month, it switches to the next month, then I can go back and forth to
04:22future and previous months.
04:24And if there were any events, you would see them listed right on the calendar.
04:27So how do you add an event?
04:29Well, in this case, let's go back to the Dashboard, and I'll scroll down, and as you see, as I
04:35mentioned before, some plug-ins add their own listing and here's one for Events Calendar.
04:41So we'll click on Events Calendar, and then below the calendar itself is the Add Event screen.
04:47Let's go ahead and put in an event, I'm going to call this one Art Conference, and the Location
04:52will be Roux Academy.
04:53We'll leave the Link out blank for now, and let's put in a short Description, call this
05:00An excellent conference for emerging and thriving artists.
05:04Now let's set the Start Date, notice the year format that you'd have to follow.
05:10I'll put in a Date in upcoming October, and we'll do a Start Time, let's start it at 9
05:16in the morning, and we'll put in an End Date the four days later.
05:20And an End Time, now I want to enter in 6:30, but because this is using the 24-hour clock,
05:26we'll need to put in 18:30 instead, and everything else we can leave as it is.
05:31As you can see, we could, if we wanted to create a separate Post for the Event, but
05:35we don't have to do that. And let's click Add Event.
05:38And now you can see on the calendar within the Dashboard, my conference is already listed.
05:44Let's go ahead and take a look at that on the page.
05:46So I'll go to All Pages, and here's my Events Calendar. Let's take a look at it.
05:52So I'll scroll down, and let's go to October, and there is the Art Conference.
05:56If I hover over it, I get more of my description, all the fields that I have entered, including
06:00the Starting Date, Starting Time, End Date, and End Time.
06:04Obviously, you could put a lot more information in here, and your clients can use this to update
06:07their events very, very easily. It's really a very powerful thing.
06:12Without a doubt, the popularity and usefulness of WordPress is greatly broadened by its extensibility via plug-ins.
Collapse this transcript
Styling plugin output
00:00Like widgets, plug-ins output generic code which needs to be customized with CSS to properly
00:06integrate into a site.
00:08Dreamweaver provides a perfect vehicle for styling plug-in generated code.
00:12In the understanding WordPress plug-ins lesson, we added the Event Calendar plug-in and created
00:17the calendar page which you see here. Now it seems to work okay in the site.
00:21But honestly, it doesn't really match perfectly.
00:24I think the header bars that you see behind each of the days really should blend in better
00:29with the site, and I think if we use this color found in the heading, and that would work well.
00:34So to work on this page what I'm going to do is pick up the URL from a browser, copy that,
00:39and then head over to Dreamweaver, and since were in Live view, I'll paste that
00:44into the location bar and hit Enter or Return, and now I have in Live view my Events Calendar.
00:51I am going to go ahead and show all file types, make sure we get everything.
00:56So now that I've open the Filter wide open again, let's go right down to just showing the CSS.
01:02So first I'll knock out PHP, and then let's knock out JavaScript, and here we see more
01:10of what we are looking for, including very important the event-calendar.css.
01:15Now what I'm want to do is find a CSS rule or rules that control this background color we see here.
01:21Let me scroll down a little bit so we see more of it.
01:23So I'll go into Inspect mode and then try to pinpoint it.
01:28So as I go into the various areas here, if I click down into this section, it looks like
01:34I have my table there and table head and <tr> tag. Let's expose more of the CSS styles panel,
01:42so I can explore a little bit more fully. Now there's the overall table calendar large.
01:47But I need to go deeper into it. So let me do Inspect one more time.
01:51What I'm looking for something that indicates what the actual header is here.
01:57There is, as you can see, WP calendarLarge and then there is a class of day header, and
02:03that seems to have the background that I need, so I'm going to click once to turn off Inspect
02:08mode while that's highlighted.
02:09And now let's scroll up, so I have my Events Calendar listed there, and I can click on
02:15the background color color-swatch that will stop the hovering from going on, and I can
02:20sample the blue of this H2 color here, and that changes the background nicely.
02:25Now the other thing I might want to change is the current day selected here.
02:30Here we still have a light blue, and let's see if we can Inspect that and find out exactly where that is.
02:35Now because this is added dynamically, often the better course is to use Live Code to determine
02:42how exactly it's being styled.
02:44So I'm going to turn off Inspect mode and switch over to Live Code.
02:48So now when I go over, and I click on this one particular area here, the 13th, I can
02:54see right now at the very bottom of the code there on line 94 the id of todayLarge.
03:01Let's go, bring that up a little bit, and that is in fact the id that I'll need to change the style.
03:09So let's locate todayLarge in the events-calendar.css.
03:14Now rather than scrolling through everything, trying to locate it, I'm just going to go
03:18head and use Dreamweaver's Find capability, and we're looking for todayLarge, just choose
03:24Find Next, and there it is on line 82, so I can now click Next to that selector.
03:31So let's bring todayLarge up into focus a bit more, and what I want to do is sample
03:36the background of the search field.
03:38So let's try and locate that on the page, and this in Dreamweaver has temporarily pushed
03:42everything down, that's okay, that'll come back to normal.
03:45But there is our keyword search, so when I click back into todayLarge, that's now on
03:51screen, so I can go to background color and sample that field.
03:54Now I'm a little worried that the contrast is going be not good between the background
03:58color and the color here, so let's change that color value, and then I'm going to go
04:03back up the page, click back into todayLarge to recover that, and let's sample the dark
04:09brown that we have here in the navigation. Okay.
04:13I think that will be a good combination.
04:17The color that you see here will only appear if there is an event at that day and time.
04:21All right, let's head back to Design view and just take a look at everything.
04:26Well, there is our newly revised calendar, and as you can see, it seems to fit a lot
04:30better into the site. Obviously, there's a lot more that you can do.
04:34But this will give you a good example of what's possible.
04:37It's really very easy to modify even plug-in style content so that it fits in perfectly
04:42with your site with Dreamweaver's Inspect and Live Code features.
Collapse this transcript
10. Extending the User Experience
Customizing the Dashboard
00:00While the WordPress administration implementation is sophisticated and powerful, it's not carved in stone.
00:06In this lesson, I will show you how to remove unwanted features, add new content, and even
00:12customize the login screen with your client's brand.
00:16Let's start by reducing the clutter on the dashboard.
00:20The Dashboard is comprised of a series of widgets, some more informative than others,
00:25and some more pertinent than others for the standard client.
00:29All of the widgets are divided in two areas, the left, which is referred to as Normal by
00:34the WordPress programmers, obviously, all south-paws, and the right, which is known as the Side.
00:41Now, to remove them, we will need to know which is which, as well as their id names.
00:46The ones I am targeting, WordPress Blog and Other WordPress News, are both on the side.
00:53Here is a list of the current dashboard widgets and their positions, Normal or Side.
00:59You will notice that WordPress Blog is known as dashboard_primary, and it's on the side,
01:06and Other News has an id of dashboard_secondary.
01:09In this lesson, all the action is in the theme's function file.
01:13So let's head over to Dreamweaver and hone in on the functions.php page that's within
01:20the roux theme folder, which is this middle one here.
01:24So I am going to go ahead and go into Code view.
01:26And as you can see, we just have a couple of functions so far, and now let's go ahead and add one more.
01:33To make life a bit simpler, I've prepared a series of snippets for this lesson.
01:38Let's go to File > Open and then navigate to the Desktop, in our Exercise Files, open
01:45up Chapter 10/10_01 and open custom_dashboard_functions.php.
01:53So this has three different snippets of code. Let's look at the first one initially, which
01:58will remove unwanted widgets from the dashboard.
02:01So dashboard widgets are all stored in a global variable called wp_meta_boxes, and that's
02:09what that first line addresses.
02:11Next, you see the unset function on line 4 and 5 here, and this will remove anything
02:19that's already there, and it's removing from the wp_meta_boxes on the dashboard side elements,
02:26not normal ones, but side, that are part of the core and then their id, dashboard_primary
02:32and dashboard_secondary.
02:33Now, after the function ends, there is an add_action which calls that function. All right.
02:39So copy this little bit of code, move over to our functions page, and I am going to put
02:45it at the end, right after my two existing functions.
02:48I like to keep my functions separated by individual lines wherever I can.
02:53So once that's pasted in, let's go ahead and save it.
02:57Now, let's head back to the dashboard and keep an eye on WordPress Blog and Other WordPress
03:02News here, after I click Refresh. And now you see that they are no longer there.
03:09So that's how you remove something from the dashboard, but how do you add something?
03:13Let's add a small help widget with some helpful info to illustrate the process.
03:18Let's switch back to Dreamweaver and my little snippet file here, and I will scroll down
03:24so we can concentrate on the second bit of code where it sets up a function called contact_help,
03:30and this is the text that will appear in my little widget.
03:34Notice that it has an echo statement, that's a PHP function for printing something out,
03:40and I have just some basic text in quotes here.
03:43The next function register_widget actually adds the dashboard widget as the function
03:47wp_add_dashboard_widget says.
03:50And the first argument you see there, contact help widget is the widget id, Need help?
03:56Is the title and contact_help is the function name.
03:59Finally, there is the add_action to hook in these functions into the existing WordPress installation.
04:06It's going to hook into the dashboard_setup, and the function that will be hooked in is register_widgets.
04:13Okay, let's copy this, and again, paste it at the bottom of our function file.
04:19I will save the page, and let's head back to Dashboard and do another Refresh, and we'll
04:27scroll down, and there is our Need help? option right there on the left at the bottom,
04:33unobtrusive, but available.
04:35Finally, let's add a little branding to our WordPress installation.
04:41The very first encounter that your clients and their workers will have with the WordPress
04:45application is the login screen.
04:47I am going to log out, so we can take a quick look at it.
04:50So if I go up to where it says Howdy, admin and then choose Log Out, that will bring me
04:56back to the default WordPress login screen.
04:58Now, as you can see, WordPress is front in center, but Roux Academy is nowhere to be seen.
05:04Let's go back to Dreamweaver and remedy that situation.
05:07First, I am going to need to copy an image that I created for the login screen.
05:12We'll find that also in the Chapter 10/10_01 folder, and I will use Finder to go get it.
05:18You want to pick up ralogo_admin.png, and we're going to put it in the htdocs/roux_academy/
05:28blog folder, drill down to wp-content/themes/roux/_images.
05:35Paste that right in, and you will see it there.
05:38Okay, let's close that window, and now we'll go back to Dreamweaver and get the code from
05:44my snippet file for this final operation.
05:48Here, we have a function called custom_login_logo, and it echoes out a bit of HTML that will
05:55replace the existing h1 anchor tag which utilizes the WordPress background image, and we'll
06:02change that so that we have our own background image, as you can see, here in _images/ralogo_admin.png.
06:10I am going to go ahead and set !important to make sure that it takes precedence.
06:14We'll add_action, we'll hook in this function to the login_head function.
06:19So, let's copy that, and in our functions.php page, paste it right in.
06:26I will save the page, go back to our browser and click Refresh.
06:32Now the logo has been replaced with a Roux Academy specific logo and the clients will
06:37be assured that they're in the right place when they first come to log in.
06:41This lesson is really just the start of what's possible in customizing the dashboard.
06:46In other lessons in this chapter, you will see how to add new functionality, as well as interactivity.
Collapse this transcript
Working with WordPress functions
00:00The initial lesson in this chapter demonstrated how you could customize the dashboard.
00:04In this lesson we'll extend the administrative customization by adding an additional sidebar
00:10widget area which will be used for inserting an advertisement, one that the client can
00:15manage without designer intervention.
00:18Customizations like these empower the client, while simultaneously freeing up the designer.
00:24Now because we are going to be modifying the sidebar code, we'll need to copy sidebar.php
00:30from the parent theme folder into the child theme folder.
00:34So I am going to expand my Files panel and then scroll up just a little bit expand custom,
00:40select sidebar.php and copy it, close up custom, select roux, and paste that in.
00:47I'll Collapse my file.
00:49Now I am going to need to close down index.php and reopen it in order for it to recognize
00:54the new sidebar.php file.
00:59So I'll locate that in my blog site here, here is index.php, and let's discover the
01:05dynamic files, and then set it into Live view and use the Custom Filter to hone in on just
01:13the files we want work with, which in this case are style.css, sidebar.php, and functions.php, click OK.
01:24And the next up is to transfer some assets from the exercise file into the images folder for our child theme.
01:32So I am going to finder, so I'm already pointing to folder 10_02 which is within the Chapter 10
01:39exercise files, and I want to pick up ad_box.gif, which as you can see, is just kind of a placeholder
01:45and then also sharp_ad.png, which is an ad that we are actually going to use.
01:51So I'll select both of those and copy the files, and now let's head over to htdocs/roux_academy,
01:58and as we've done before drill down into blog/wp_content/themes/roux and then _images.
02:06And once we're there, Command+V will paste in those images.
02:10Now we are ready to bring the code for the new sidebar widget into the sidebar.php file.
02:14To save time, I have stored both the HTML/PHP code as well as the associated CSS in the exercise files.
02:25So from Dreamweaver, let's go to File > Open and then navigate to our Desktop/Exercise Files folder,
02:30open up Chapter 10/10_02, and we want to get the advert_widget_code.php file.
02:38So let's go into Code view, and this first group of code that you see up here starting
02:45with the div acts as a placeholder for our widget functionality.
02:50The initial div tag as an in-line style which sets the background to transparent and uses
02:57a specific image that ad_box.gif as a placeholder.
03:02Now within that div wrapper is a PHP if function that checks to see if the dynamic_sidebar
03:10function exists, and if there is also a dynamic_sidebar named home_ad_1; otherwise, it puts in another bit of code.
03:18So let's grab that code block, and we'll head over to sidebar.php, let's go into Code view
03:26here, and I want to put my new sidebar_widget below the existing sidebar widget area, and
03:33I want to put my new sidebar widget below the existing one, so I'm going to put it right
03:38before the closing div here, and that should make the advertisement fall right below all
03:43of the other widgets, no matter how many are defined.
03:46Our advertisement is going to needs some styling, so let's go grab that bit of CSS that I have
03:51in the advert code widget, and as you can see, this just targets the class advert and
03:57sets up a specific width and height as well as some padding and margin.
04:01So I am going to copy that and go over to our roux stylesheet, which is the first one listed here.
04:08We'll go down right in front of the phone declarations that we've been working on and paste that in.
04:15Okay, two of the constituent parts are in place. Time to bring in the real engine, the function code.
04:21Again, I've put the necessary code in an exercise file.
04:25So I'll go to File > Open, and we'll head on over to our Exercise Files/Chapter 10/10_02
04:33and choose the widget_function_code.php file.
04:38Now this is the code for registering a new sidebar, and it specifies the Home Ad Space 1,
04:44so let me go ahead and copy this and back to index.php, and we'll go to our roux functions
04:53file, and I am going to put it pretty much right at the top but within my PHP code block.
04:58So I'll make a little room and paste it right in.
05:01As you can see, working with functions is more than just adding a code snippet to the functions.php page.
05:07Now let's save all the related files by going to File > Save All Related Files and then
05:13we go into Design view, and I'll Refresh the page.
05:16And once that's down, let me scroll down, and there below the last widget, which is Categories,
05:22you see a placeholder for an advertisement.
05:25Now if you squint really hard, you can see the word Advertisement written in very small
05:30type at the top there.
05:33Okay, time to move to the WordPress side of the workflow where we'll see our new widget
05:38area and put it to use.
05:40So now I am going to go to Appearance > Widgets, and where there was just Sidebar Widgets before--
05:46and let me expand that so you see the ones that we have in place--there is now a new
05:50Home Ad Space 1 widget.
05:52I could drag any of the existing widgets into my ad area, but none of them do exactly what
05:58I want, which is to insert an image.
06:00Luckily there's one that does, and it's very easy to set up and use.
06:05Let's go get it by going to Plugins > Add New and search for image widget.
06:12The one at the very top of the list is what we are looking for.
06:16So let's click Install Now, click OK to confirm, and after WordPress has installed it, activate the plug-in.
06:24Now when we head back to Appearance Widgets, I have an image widget here, and I can go
06:30on drag it and drop it right into my Home Ad Space.
06:35The parameters will open up here, and we want to leave the Title blank, add a new image,
06:41and I am going to select the files from my computer, and we can get this from either place.
06:47I am going to ahead and just get it from my htdocs/_images folder where I copied in the
06:54sharp_ad.png file, click Open, and there it is.
06:59Now we'll scroll down, leave everything else as is, and click Insert Into Widget.
07:04Now one little gotcha, this widget tends to add the file name as the default Title.
07:10You want to remove that because we don't need to have a Title for an advertisement.
07:15There is lots of other features here, we could put in a Caption, again probably not necessary.
07:20You could link to the advertiser, an excellent idea, and you probably want to open that into
07:26a new window when you do.
07:27You can see the specific Width and Height that's given and the Alignment should be at center.
07:33Let's sharpen up the Alternate Text, no pun intended, just happens sometimes, so I'll make
07:39this Sharp Art Supplies.
07:41All right, now let's click Save, and let's see how that new ad is looking.
07:47So I'll go back and visit the site, click Refresh and scroll down, and there is our advertisement.
07:54Now that we have our single ad system in place which gives total control to the client, we
07:59are ready to take it to the next level and allow the client to interactively add multiple advertisements.
Collapse this transcript
Including administration interactivity
00:00Increasingly, I found clients are asking for more and more control over their website.
00:05WordPress gives you the power to expose that control right in its administrative interface of the dashboard.
00:12In this lesson, we'll take the sidebar advertisement that was introduced in the previous lesson
00:17and extend it so that the client can decide how many ads to show, or whether not to show
00:23any ads at all, right from a Custom option in the dashboard.
00:26To build a custom interface, we are going to be working in Dreamweaver with two of our
00:31roux theme pages, sidebar.php, and functions.php.
00:36So I have used a Custom filter to restrict our dynamically related files to those pages
00:41as well as the style.css files.
00:44Let's start in sidebar.php, and I'll go into Code, so we have a maximum view here.
00:50First we are going to put in a PHP code block that will get the options for this specific
00:54interactive operation, and we are going to put this code block right in front of our new ad space.
01:00So as I said, this is the PHP code block that sets the variable $options= the function
01:08get_option(); of course, and the option that we are going to be getting in single quotes
01:16is named ('plug-in_options').
01:20WordPress stores a full table of options, everything from the site name to how many posts to show.
01:26With this code we are getting some Custom options that we'll create a little later.
01:30Next, I am going to add a conditional wrapper around my ad code so that it will be shown
01:36if the Select menu that we're inserting into the dashboard shows one or higher; if it shows 0,
01:43the ad won't be displayed.
01:45Let's scroll down a little bit and then after the Options code block, we'll add another.
01:51And this one is if ($options square bracket'home_page_ads' square bracket >= 1),
02:05then finally close the parentheses and leave an open curly brace.
02:09If that's all true, then all of this that we have here, starting with the <div id="home_ad_1"
02:15and ending with the closing of that div will take place.
02:19Now let's add the closing part of that wrapper after the ad code, and all we need here is
02:23just a closing curly brace.
02:26Now that I have this solid foundation for a conditional ad, I can copy and paste it
02:32as many times as I need to, and this fictional scenario. The client has requested that she
02:37will be able to display up to three ads.
02:40So I am going to copy my ad Code block along with a conditional wrapper.
02:45Now that that's selected, let's copy it, and I am just going to add an additional line
02:48down below here and paste it in, first one time, and we will change three different values
02:54to make it a unique ad.
02:56So the first one we will change is the condition itself, and if the options show two or more,
03:02we will be able to show this ad.
03:04Now we want to change the id from home_ad_1 to home_ad_2, and we also want to change
03:09the dynamic_sidebar from home_ad_1 to home_ad_2.
03:13Okay, so you see how this works.
03:15Let's go ahead and copy 2 this time and then paste it in and make another change, so we
03:22will change the options from 2 to 3, the id from home_ad_2 to the home_ad_3, and then
03:28finally, the dynamic_sidebar from home_ad_2 to home_ad_3.
03:31All right, so our work in sidebar.php is actually done, so I am going to Save the page, and
03:38let's move onto functions.php, making sure that we are working in the roux functions.php file.
03:45Now the first bit of work is going to parallel what we just did in the sidebar. Every potential
03:51ad widget we put in the sidebar--and we had three--will need to be registered.
03:56And they'll be registered only if the client wants the advertisement there and has selected
04:02the appropriate option.
04:03So right after if function exists, we are going to put in our options variable and set
04:11that =get_option function with the argument ('plug-in_options') closing off the quotes
04:19and parentheses as needed.
04:21Add a semicolon at the end, and we are ready to move on.
04:24Now we are going to wrap our sidebar_registration with the same PHP if block.
04:29So if ($options and then the options we are interested in are the home_page_ads are >= 1,
04:41and we will insert an opening curly brace to indicate where we start to do
04:45our objects, and now after the double parentheses, semicolon, we put in the closing curly brace.
04:53So if the options are pointing to one or more, we will register this as sidebar.
04:58Now we'll do the same copy paste routine as we did on the sidebar of duping the Code block
05:03twice more and changing the pertinent values. So let's grab all of that code there.
05:09I am just going to create a little bit extra line here to separate these, so it makes it easier to read.
05:14Again, we'll need to change three places, first the if options, we'll change that from 1 to 2.
05:22Now we are going to change the name, also from 1 to 2, and the id from home_ad_1 to
05:27home_ad_2, pretty simple, eh? So let's move on and do the next one.
05:31I'll copy what I just inserted, add another line, and paste my second one in and then change to the 2s to 3.
05:43Now let me save my functions.php file before we move on. All of our foundation work is
05:50now done, and it's time to add the code that we'll create and insert the new Admin setting page.
05:56It will take a fair amount of sophisticated code to pull this off, but I have stored it
06:01all as an exercise file page.
06:03Let's open it up, so I can explain how it all works.
06:06You'll find that there are five major Code blocks, so I am going to File > Open, navigate
06:12to the Desktop where our exercise files are, and open up Chapter 10/10_03, where you'll
06:19find the file custom_settings.php.
06:23Now we are going to eventually insert all of this code, so I am going to walk through
06:27the code on this page, and then we will copy and paste the whole thing over.
06:31First, there is the function that creates the theme Options page, and this inserts a
06:37menu item into the Admin menu called Advertisements.
06:42You can see the title that's here as the second argument for add_options_page and the final
06:47options is the next function that is called build_options_page.
06:50Let me scroll down a little bit here, so you see it all.
06:53This will create the actual page that is presented in the Dashboard.
06:58You can see we're working with standard HTML here. There is a larger div with an id of
07:04theme-options-wrap, that's a standard WordPress id, and then within that there is a method
07:10div with a class of icon32 and an id of an icon-tools.
07:15Now what this will do is present as Standard WordPress icon on that page so that our page
07:21fits in with the rest of the Administrative Dashboard.
07:24After that we have regular HTML that sets up a title, Advertisements, puts in a little
07:30bit of descriptive text as to what you should do,
07:32set the number of ads in the sidebar and a form, and within that form are some specific PHP
07:39code blocks that will bring in the setting fields that we are about to define.
07:44These setting fields will be a label and a select menu. After that is the Submit button
07:50that you see here, and as you can see, the value is another PHP code block that gives
07:54the title for the button Save Changes, all very familiar interface elements in WordPress.
08:00Let's move on to the next code block which has the responsibility of initializing different
08:05sections of the page, including the form elements. Following that are two small functions that
08:11validate the setting and set up the section for any check boxes.
08:15We'll notice there is no functionality here, because we're not using check boxes.
08:19You do need to include this, however, to make the form work properly.
08:23The final function sets up the select menu specifically, and here you can see on line
08:2843 is an array, and these are the actual values that will be displayed in the select element,
08:34starting with 0 and going up to 3.
08:36In the next line, line 44, writes in the HTML code for the select list, then there's a loop
08:43that will go through each of the items that are in the array and determine whether they
08:47are selected or not, and that's all there is.
08:50So I'm going to go ahead and do a Command+A to select everything and then Command+C to copy it.
08:57Now let's go over to our index.php file, and I am going to scroll to the top of the page
09:03and paste it in there as a separate code block. Okay.
09:07Let's save this page and head over to the Dashboard to see how it works.
09:12Back at the Dashboard, all you need to do is Refresh the page. Once it's refreshed,
09:17let's look under Settings, and now you see a new entry all the way at the bottom called
09:21Advertisements, click that, and there's our Advertisements page with the Tool icon I was
09:28referring to earlier, a little bit of descriptive text, here is the label for the field,
09:33Page Ads, however many do you want. So the default setting is 0.
09:37Let's go to our site and see if there are any ads or not.
09:41So I'll click on that, Refresh the page, and then scroll down, no Advertisements.
09:47All right, let's head back, now let's add our first advertisement and Save the Changes.
09:53Let's check out the site, and there is the Advertisement that we had put in before.
09:58Let's try one more time. This time let's go up to three advertisements, Save the Changes,
10:04and visit our site, and there is our Sharp Art Supplies and two placeholder advertisements.
10:10Now let's go to the Dashboard, into our Widgets area, and here you see the additional two
10:19widgets available to the client.
10:21Now the client at this point could expand Home Ad Space 2, drag them Image Widget, and
10:27choose another advertisement for that particular space, and the ads will be good to go.
10:33This lesson demonstrates the flexibility of extending and customizing the WordPress Dashboard.
10:38You know that saying, your only limit is your imagination?
10:41Well, it pretty much is with Dreamweaver and WordPress.
Collapse this transcript
11. Integrating WordPress Database Content into Dreamweaver Pages
Setting up the data in WordPress
00:00The WordPress Content Editor is one of the hallmarks of the entire Content Management System.
00:05While it's great for adding content to blogs, did you know that you could also include the
00:10material entered through the editor into your own Dreamweaver designed and maintained dynamic pages?
00:17One way to do this is by using specific WordPress categories and the private visibility setting.
00:24Let me show you how this is done.
00:26Let's switch to the dashboard. We'll start by adding a new post, which I'm going to call Student Exhibit.
00:33Let me put in some sample text.
00:35Now I also want to put in a few bullet points and then one last closing line.
00:43For now I want to do a couple of things, one of which we haven't done before with post.
00:48First, over here under the Publish category, you'll see that there's a visibility option
00:53that's set to Public by default.
00:56Let me click on Edit to expose the options, and we'll choose Private.
01:00By changing the visibility from Public to Private, it insures that only the administrator can see the post.
01:06So I'll click OK.
01:08Next, I want to put this in a new category, and WordPress actually makes this very easy
01:13even directly from adding new posts.
01:16So if I scroll down a little bit, you can see the Add New Category option here.
01:20I'll click that and another series of options opens up.
01:24Here I can put in my new category name, and that's going to be Exhibits, I don't need
01:28a Parent Category for this, so I can just go ahead and Add New Category.
01:32WordPress not only adds it, but it selects it as well.
01:34So let me click Update and view posts. Because we're logged in as administrator, we can see it.
01:40Now notice if I hover over the category of links that we see here, down in the lower
01:45left of the browser, you see a URL ending in cat=10. Cat is short for category,
01:51and 10 is the id for my new category Exhibits.
01:55It's very likely that your category number may be different. I've created some additional
02:00categories and removed some in development of the course, and WordPress assigns these
02:04category numbers sequentially.
02:06But whatever the number is, make a note of it, because we'll be using that value in the
02:10next lesson when we bring this data into a standard Dreamweaver dynamic page.
Collapse this transcript
Adding dynamic data from WordPress to your web pages
00:00Time to bring the data from WordPress right into Dreamweaver.
00:03In this lesson, we'll show you how to make a database connection, create a record set
00:08and then add the data from that record set to your Dreamweaver page.
00:12So in Dreamweaver, let's open up a previously created file to hold our dynamic data.
00:17Now this is just a standard PHP page. It's not hooked into WordPress at all.
00:22I am going to go to File > Open and then navigate to my Desktop > Exercise Files, go down to
00:27Chapter 11, and open up 11_02. I'll open that up, and it'll come in unstyled.
00:32So the very first thing we are going to do is save it to the local Site Root.
00:37So choose File > Save As and then on the Save As dialog box, click Site Root and Save.
00:46Now you do not want to update the links because this is coming in with all the links intact,
00:51so click No, and there is our basic page we styled with a Exhibits header.
00:56Let me go into Live view, so you can see the full page, and it conforms to the rest of
01:00the site, not to our blog_comp.
01:03Now the next step is to create a connection to the MySQL database used by WordPress.
01:09Now I'm going to need to open up my Database panel, but I need to drop out of Live view
01:13temporarily for that to happen.
01:15We'll click on Live view and then go to Window > Databases, and that will open up the Database
01:21panel which also has Bindings and Server Behaviors as well.
01:24We want to add a new MySQL connection.
01:27So, click on the plus sign and choose MySQL Connection.
01:31Now let's give our connection a name.
01:33I like starting with C-O-N-N, conn, and I am going to call this connExhibits.
01:37MySQL server is localhost, my User name is Root, my Password is also root.
01:44Now that we've entered the first four fields, we can click Select.
01:47If you try to click Select before then, you won't see any databases.
01:51So click Select, and there is the databases that have been set up on my localhost.
01:56Here is roux_blog, that's the one we want, so we'll click OK.
01:59Now, it's always a good idea to test to make sure that it connects all right, and everything looks beautiful.
02:04So let's click OK once and then again to make that connection.
02:09Now what Dreamweaver is actually doing is in the Site Root, it creates a folder called
02:13Connections and then puts a PHP page with your Connection name as the file name, so
02:19here we see connExhibits.php.
02:23Now we are ready to go to the Bindings tab.
02:25So I am going to collapse files and then click on my Bindings here, and here you can see that
02:30we have three out of the four steps already established, and we are going to complete
02:35that forth step by adding a record set, but that record set is going to employ a fairly
02:40complex bit of SQL.
02:42So to save a little time, I have gone ahead and created that for you.
02:46I am going to open up that file from the exercise files again.
02:49So go over to File > Open, and let's head back to our Desktop > Exercise Files in Chapter 11,
02:56again 11_02, and this time open up recordset.sql.
02:59So you may look at this, and if you're not that familiar with SQL and think of it as
03:04a very complex SQL statement, it's actually relatively straightforward.
03:09Let me walk through it a little bit so you understand it better.
03:12But basically, what we are doing here is selecting a set of records, hence the name recordset.
03:18So we want the recordset to be distinct so that there are no duplicates, and that's the
03:22keyword distinct here, and we are going to bring in the WordPress post title as well as the content.
03:29So just those two items, the title and the content, and we're bringing those in from
03:34a table called wp_posts which is pretty much self- explanatory, and then also the wp_term_relationships
03:40table is being used.
03:43Now that's the table that monitors the categories among other things and its relationship to the various posts.
03:49So after that connection is made here in the WHERE statement, we want to make sure that
03:55we are filtering on a field called post_status listed here, and that is set to private and
04:01then also another field in the wp_term_relationships table called term_taxonomy_id, and that's
04:09going to be set to a specific value.
04:11Now just because I use this SQL statement a lot, I have this set up with a couple of
04:16question marks, but we want to replace those question marks with a certain value,
04:20and what is that value?
04:21Well, it's going to be the category number that we saw earlier, which as you might recall for me is 10.
04:27The order of the records that is returned, which is the next and final line on the SQL
04:32statement, is set to showing the newest one first or in other words the dates descend.
04:38So I am going to select the SQL statement, copy it, and head back to my exhibits.php file
04:44where we are ready to create the recordset.
04:46So I'm in the Bindings panel, I'll choose the plus sign, and then select Recordset (Query).
04:51Now what you see on the screen here is what's known as the simple version of the Recordset.
04:57There are two different views. We want to switch to the Advanced view.
05:01Now if you have done some database work before, and you have established another recordset
05:06where you did use Advanced view, that will come up automatically.
05:08So, I am going to call this rsExhibits.
05:10And I want to make sure that my connection is set to connExhibits, and since that's our
05:16only connection, that's what's going to happen.
05:18Now after I press Tab, it goes to the SQL field, and I can delete what's selected and
05:24paste in with a Command+V, MySQL statement.
05:27Now let's go ahead and test this by clicking the Test button here.
05:31And here you see the one record that we have, Student Exhibit, and a little bit of content there.
05:36That's good. So click OK once and then one more time to close the Recordset. All right.
05:42We are actually ready to bring the content onto the page.
05:45So I am going to put my cursor where I want it to appear, and you have to do this in Design view,
05:48you can't do it in Live view, and I am just going to put it right after the paragraph,
05:52and I am going to expand my Recordset that you see here--let me bring the Field name
05:58over a little bit so you can see all the information--
06:01and here you see the two fields that we brought in, post_title and post_content.
06:05We are going to insert post_title first.
06:08So you can drag and drop it onto the screen, or if you've already positioned your cursor
06:13as I have where you wanted to go, you can select what you want and then click Insert.
06:18Now, that will come in as a standard paragraph, as you can see down here in the Tag Selector
06:23at the bottom of the screen.
06:24Let me open up my Property Inspector, and I am going to change that Format to an h2 tag.
06:30After that, I'll hit Return so after the title we'll put in the content.
06:33Now, this time I am just going to go ahead and drag that content in to show you the alternative
06:37way that you can work with this, and each time I do, you see that it lists in curly braces,
06:43and it slightly highlighted the Recordset name rsExhibits and then dot and whatever the field name is.
06:49Okay, so there is our two bits of content.
06:52Let's save the page, and now I am going to go into Live view, and Live view works not
06:57only for CSS and PHP, but it also works for MySQL.
07:02So we can see that brings in the dynamic content, and we do have a little bit of work to do
07:07here, but that's good because it shows that up.
07:09So I am going to go ahead and create a new CSS rule in main.css.
07:14Let's go down a little bit here, and I'll put it towards the bottom, right above the
07:18@media statement for my phone.
07:20So this will be one for mainContent and an unordered list, and that will handle any unordered
07:26lists that are encountered here.
07:28I am just going to set the margin, 0 at the top, 0 on the right, do 15 pixels on the bottom,
07:36and 20 pixels on the left.
07:38So I'll save that and then head back to Design view, and it's much better.
07:41But at the moment, this dynamic page would only show one event.
07:45So if I toggle off Live view, you can see that I just have these two bits of code here,
07:51moreover, the event that it would always show would be the most current.
07:54Now that might work in some situations, that might be in fact exactly what you want to
07:58do, but let's say we want it to show multiple events.
08:02So what do we have to do?
08:03Well, what we need to do is wrap whatever it is we want to repeat in what's known as
08:08a Repeat Region server behavior.
08:11So I am going to add one more bit of content, and that's a horizontal rule here, and I'll
08:16put that right after my content so that we have a little bit of separation between the two.
08:22I am just going to go right to the Source Code and put my cursor there.
08:26So instead of a paragraph tag here, I'll make this an hr tag, okay.
08:31So, we'll save that and then head back to Design view, and you can see my new horizontal rule there.
08:37So now we are ready to add a Dreamweaver server behavior.
08:40I am actually going to go back into the Split view as I found it's actually easier a lot
08:44of times to select exactly the content that you want.
08:48And in this case, what I want are these three code lines here, the h2 which has the PHP
08:54code for showing the title, the paragraph tag which has the PHP code for showing post_content,
09:00and then my horizontal rule.
09:02With that selected, let's go over to our Server Behaviors panel where you can see certain
09:07Server Behaviors have already been added. There is our Recordset, and these are the two
09:10items that we inserted into the text.
09:13So, I'll click the Add button and choose the second option which is Repeat Region.
09:18Now when it comes up, you'll show a list of your recordsets. If we had more than one defined,
09:23it would be available to us from the list here, but we only have rsExhibits.
09:27So that's pre-selected for us.
09:29And there is two options. You can choose to show a finite number of records at a time,
09:32and it's definable, it can be 10 as the default setting is or 5 or 3, or if you want to show
09:39all the records as we do, you can choose All Records.
09:42So then click OK and Dreamweaver will add in the necessary code, it's a PHP do-while loop.
09:48And let's go back to Design view now, and we'll turn on Live view, click Save and right
09:53now what you'll see is basic code, so we still have just one bit of content here, so you're
09:59only going to see one record.
10:01Let's go back to WordPress, and I'm going to add a new post that I'll call Spotlight
10:06Exhibit, and we have some sample content as well.
10:09And again, I am going to add in a few bullet points.
10:11Okay, we are going to do those same two things that we did before when we changed the visibility
10:16to private, so let's go over to Edit, next to Visibility, change that to Private, and
10:21click OK, and we already have our Exhibit category set up, so I'll click Exhibits and Update.
10:28Let's head back to Dreamweaver, and I am just going to refresh the page, and now we have
10:32two exhibits listed on our Exhibit page, Spotlight Exhibit, and Student Exhibit.
10:38There is the separator and everything looks in proper date order that we had set up.
10:42So, this is really just the start of what you can do with data from a WordPress-driven database.
10:49All of the other Dreamweaver Server Behaviors are at your disposal as well.
Collapse this transcript
12. WordPress Administration
Modifying general settings
00:00A lot of thought has gone into the administrative settings found in the WordPress Dashboard.
00:05You can easily customize it to best fit the workflow for you or your client.
00:09So here in WordPress, let's go right down to where the settings are over on the left-hand
00:15side, and I'll click once to expand that and go to the first option which is the General Settings.
00:21So this is where the blog Title and Tagline are found, should you ever need to change them.
00:26Now, we never used the description or the Tagline here.
00:30So I'm just going to go ahead and delete it.
00:33It really depends on the theme, some themes actually incorporate that as part of the title,
00:38so you want to be careful with that to look up at your title as you're developing your
00:42pages, because having the Tagline just another WordPress site might be a bit of a downer for some clients.
00:48We can also, if needed, change the WordPress Address and the Site Address.
00:53Most of the time, you won't have to do that The little bit of information that it says
00:57here about Entering the address if you want your site homepage to be different from the
01:01directory, you install WordPress.
01:03It's a little misleading. It's not quite as seamless as it would appear.
01:08So I recommended that you keep these the same and use some of the techniques that we covered
01:12early on to handle that, using the custom function that I developed called Site Root,
01:17for example. Other settings, Email Address, obviously, this is required for admin purposes.
01:23You can set it up if you have a site that involves people having to register in order
01:28to view the site, control who can register through the Membership option here, and there
01:33are other settings, including the User Default Role.
01:36Now I'll be covering Users a bit later, so let's skip over that for now.
01:40Scroll down past the Timezone, and of course you can modify all of those things.
01:45I have made some modifications here, so I'm going to go ahead and click Save Changes.
01:49And now the next settings category I want to show you is Permalinks.
01:54If you recall, every time you create a page or put up a post, WordPress creates a Permalink
01:59to display that page or post.
02:02Now by default, it uses the syntax that you see up top there, where it simply puts the
02:07path to your folder a question mark and a P for post, equaling whatever their database id is.
02:13If it's a page, you'll see the word page, and an equal sign and database id.
02:18Now you can make that much more English readable if you want by choosing any of the other
02:22options you see here.
02:24I have to issue a very strong warning here. There's a known bug in Dreamweaver that prevents
02:29dynamically-related files from being recognized as such, should you change the Permalink setting.
02:34It's been around for a while and has caught a great many Dreamweaver users.
02:38So hopefully it will be fixed soon, but if you make a change like choosing Post name
02:44for your Permalink Setting and then choose Save Changes, and you go back to Dreamweaver
02:48and encounter this issue, you'll know what to do.
02:51You'll need to come back here and change it to Default.
02:53It doesn't mean that on your Live Site you can't change the Permalink Setting there to
02:58your Post name, which is a workaround that I've used before.
03:01I'm not going to make or save any changes here, so let's just go on to the next category
03:05I want to show you, which is Media.
03:07This is where you set up the maximum dimensions for images that you want to bring into a post.
03:11I found that the defaults are okay, but it really depends on the design of your layout,
03:16whether they should be larger or not.
03:18The section that I want to focus on, though, is down towards the bottom, and that concerns
03:23the Uploading of Files.
03:24By default, WordPress stores its Uploads in the wp-content/uploads folder.
03:31You can customize that if you want by entering a new path here.
03:34Another option that I think is key for organizing your uploads is the Organize my uploads into
03:39month- and year-based folders choice.
03:42Now I have clients who really hate the way that WordPress sets this up, and I have other
03:46clients who really like it.
03:48So it's something that you may have to change at some point.
03:52If you do change it, any images or other documents that you've already uploaded will still be
03:56in those initial folders, and any new assets that are added moving forward will be set up
04:02according to your new structure.
04:04So that's an overview of the most important settings.
04:07In the next lesson, I'll show you how to manage your WordPress sites users.
Collapse this transcript
Setting up users
00:00One of the greatest benefits to working with WordPress is its ability to handle multiple users.
00:06Not only is it set up to allow any number of users to work on entering and editing content,
00:11there are built-in roles that can control who can do what.
00:14So I'm going to expand the Users category that you see here, and besides your own profile
00:20you also see a list of all users which in our case is just the one, and of course you
00:25can always add new users.
00:27A typical situation that might come into play is when you hand the site over to a client.
00:32So I'm going to go ahead and add in a new user, and I can choose Add New from the top
00:36here or from the navigation over on the left and start filling out the new User Form.
00:42So our fictional client, we'll give her name of Debra and call here deb@client.com, her
00:49name of course is Debra Client.
00:51We can leave the website blank, or you can fill that, not really necessary.
00:54We have to put in a Password.
00:57The next option is very handy, especially if you're setting up a lot of users.
01:01You can establish temporary passwords for them themselves and then send it to the new user by email
01:07by selecting this box.
01:09Now since that email address is not real, I'm going to go head and deselect the Send the password.
01:14But I find that a really helpful option. And then the next thing, selecting the Role for
01:18that particular user.
01:20The default Role as set up in the general settings is Subscriber.
01:25You can change that and make the default Role Contributor if you're adding a number of contributors
01:31to your client's website.
01:33There are in all five different roles each with different capabilities.
01:37Even though the Subscriber is at the top of the list, it's really at the bottom of the
01:41totem pole in terms of what they can do so they can basically just read the site.
01:46Let's setup Deb Client as Administrator and click Add New User.
01:51That will take us back to the initial list. You'll notice up here the two link options,
01:55there's one for All for showing all users and one for Administrators.
01:59If I were to change Debra here from Administrator to let's say Editor--and I'm in her profile
02:06at this point--and then go back to users, you'll see that not only is it updated in the listings
02:12here, but it's also Updated up top here, so I can quickly shift to show just my Editors
02:18or just my Administrators.
02:20One other thing that you should be aware of is once you set up your additional user, you
02:25might want to go back into your Post, especially if you've had the responsibility for adding
02:30in the content as you're developing the site.
02:33And what you might want to do is to go in and do a Quick Edit for a particular Post
02:38and change the Author.
02:40Now originally, you only have the administrator Author, but the more users you add, the more
02:46options you'll have for Authors.
02:47So I can now change this to Debra, and if there were on the site someplace where we
02:53had a byline and that information was made public, her name would then appear on the site.
02:59For many situations, the default user functionality is often enough.
03:03But if you need more control over who can see your content, you'll probably need to
03:07bring in a plug-in, and we'll look at that in the next lesson.
Collapse this transcript
Restricting access to specific WordPress pages
00:00While WordPress is great for communicating across the Internet, all pages within your
00:04site don't have to be accessible to everyone.
00:07With the help of a plug-in, you can determine who sees what Pages, Posts, and even what Content within a Post.
00:14I'm going to go in and install a new plug-in by switching to the Plugins category and choosing
00:20Add New, and we're going to search for a plug-in called restrict content.
00:25Then one I'm looking for is right up the top of the page, and it's by a gentleman named Pippin Williamson.
00:32As you can see, he also has a number of other versions that have specific purposes as well
00:37as a Pro version of the general Restrict Content plug-in.
00:42But this one is free, and we can take a look at the Details if you like.
00:45I always recommend that you check out the details before you install a plug-in, because
00:50it will have ratings as well as specific information of when it was updated and whether there have
00:56been any problems encountered with compatibility of most recent WordPress versions, so this
01:02was very recently updated, just 6 days ago. We're ready to go ahead and click Install Now.
01:08Once it's installed, I can activate the plug-in.
01:11If you're interested more details about this particular plug-in, I recommend you go to his
01:15website, pippinsplug-ins.com, where you can find information about a variety of free plug-ins,
01:21as well as his commercial ones.
01:23To show you how this plug-in works, let's add a new post. I'm going to call this Private
01:28Showing and add just a little bit of content. Of course, you could put in more details later,
01:33but the point is that we have a new post here, and if I scroll down--I'll click Exhibits just
01:38so it shows up there--you'll see a new widget category called Restrict this content, and that was added by the plug-in.
01:45Here we can set the User Level, which right now it's set to None which means everybody can see it,
01:51but if I expand the list, here you see my standard WordPress user roles, and let's say that I
01:57want to restrict it to just Administrators, and I also want to hide it from the RSS feed
02:03which is a good point, because you don't want to broadcast this generally to everyone.
02:08So now I'll scroll up a little bit, click Publish, and I can view the post, which I do
02:12of course see because I'm logged in as the Administrator.
02:16So I'm just going to copy this link very quickly, head back to the Dashboard, now I'm going to Log Out.
02:23Now once I've logged out, let me put that link back in and go back to that same page and
02:28here you'll see the title of the post but no content.
02:31Okay, that's pretty good, it gives us a simple way of restricting the content of a post,
02:37but we can actually do a little bit better here.
02:39So I'm going to go back, actually log back in, and let's go to our Posts and do an Edit.
02:48Now I'm going to add a second line, "Please join us for a private reception at 8pm."
02:54Now to make sure that only certain people see this, I'm going to enter in the short
02:59code that's part of this plug-in.
03:01Short codes are maintained within a square bracket, so I'm going to put my opening short code in front.
03:08So it's a square bracket and then keyword restrict, and I also want to set a User Level,
03:14so I'm going to enter in userlevel, all one word = and then whatever role that I want to restrict it to,
03:21then we want to add in the name of the user level, in this case administrator is actually
03:25shortened to admin, so I'll type that in and enter it in another quote.
03:29And then we want to put in the closing restrict also in square brackets and like HTML tags
03:37it uses a forward slash to indicate that it's the end of the tag, and then the keyword restrict, okay.
03:44So let's click Update and check out our post, I'll click refresh to bring everything in,
03:49and here you see both lines of the Private Showing post.
03:54Now let me go ahead and Log Out, and then I'll hit the back button and refresh one more time,
04:01and now because I'm not a logged in Administrator, I don't see that bit of content.
04:05But I found that this is a pretty effective way of handling access to your various web pages
04:10and their particular content, and it really adds to the flexibility of your WordPress site.
Collapse this transcript
13. Publishing a WordPress Site
Exporting and importing WordPress files
00:00As noted earlier in the course, WordPress stores all the site's post pages and other info safely
00:06in a database so you never have to worry, right? Because nothing ever goes wrong, right?
00:11Well, in the real world, things do happen, servers crash, data gets corrupted, web host go offline.
00:18It's best to be safe and know how to take control of your WordPress data.
00:22In this chapter we'll examine two ways to do just that.
00:25One method outside of WordPress and in this lesson one method built right in.
00:31WordPress includes tools for both exporting and importing its data.
00:35You'll find them handily stored right under the Tools menu.
00:38So let's take a look at Export first.
00:42WordPress exports its data to a text file utilizing a version of XML they call WordPress
00:47eXtended RSS, or WXR.
00:50Honestly, it doesn't matter what they call it because it just works, and the only thing
00:55it's really useful for is outputting your data so you can import it using another of
01:00their tools which we'll get into a little bit later.
01:03As you can see, from the Export screen you have the option of exporting All of your data
01:07or just the Posts or just the Pages.
01:10Let's try it out with the Export All Content option.
01:13So I'm going to click Download Export File.
01:17Google Chrome will save it down here to the bottom.
01:20I'm going to show it in Finder, and there is a file.
01:24WordPress automatically gives a file a name that includes your site name, the word WordPress,
01:29so you know where the data came from, and the date.
01:31This is really helpful when making backups on a regular basis.
01:35Now let's switch over to Dreamweaver and open up that file, because as you probably know
01:41Dreamweaver speaks XML quite well.
01:44So I'll go to File > Open, navigate to my Downloads and then double-click on that XML file.
01:51Up top in the Comments section, there are some instructions on how to work with this file,
01:55primarily importing it back into WordPress, which we'll cover later in this lesson.
02:00Then after that, the actual data begins.
02:02Let's scroll down a little bit, and here we can see a number of categories being defined.
02:08You see both the term_id listed as the first item and then after that what WordPress calls
02:14the category_nicename, and what's shown in the Dashboard as the slug.
02:18A little further down, you'll start to see some sample content.
02:22Now this is the page that's included as a sample page, and once we get past that,
02:27we can see some content that we entered.
02:30Chances are you won't really need to open the file and look at anything or manipulate anything.
02:34You just use it as a source file that you can later import.
02:38Besides backing up your data, one of the primary uses that I found with WordPress' Export
02:43Import features is to move content developed locally to a live site.
02:48So to demonstrate that, I've set up another WordPress installation on my local server
02:52here called roux2 so you can see how it's done.
02:56Let's go back to the browser, and there's a second tab here shows my roux2 site, as
03:02you can see by the path up there, and I'll click Dismiss.
03:05I've also named the site Roux Academy Live just to distinguish it from our development site.
03:10As you can see, this WordPress site is brand-new, just-installed condition.
03:15So let's bring in the data that we exported, and we'll see what happens.
03:19So I go to Tools and choose Import. You'll find a host of import possibilities.
03:24The one we're most interested in is the last one, WordPress. So click that.
03:29Now that, that's installed, let's Activate the Plug-in and Run the Importer.
03:33So we get to choose an exported file, which as you recall we put in our Downloads folder
03:40and here it is here. So I'll select that.
03:43Click Open and then Upload file and import.
03:47After WordPress has brought in the file it reads through all the users, and as it says,
03:51sets up new passwords that are randomly generated for each one.
03:55Now you will need to go in and modify those passwords to make sure that they're properly set up.
04:01So you have the option for importing an author and putting them on a new username or assigning
04:06them to an existing user.
04:08In this case, we're going to set it up as admin and importing another author here which
04:13I could put in as a separate username if I wanted to.
04:16I don't really want to assign it to my only other existing user.
04:20So one strategy is you might before you import set up additional users and bring in that data,
04:27if you know ahead of time that you're working with that kind of situation.
04:30The option for downloading and importing file attachments, and let's click that and then click Submit.
04:36It reminds you to update the passwords and roles of imported users.
04:42So you would want to go over and edit Debra's and then put in her New Password or her old
04:49password, Update the User.
04:53Now let's head over to the Dashboard to see that we have our post that we've added.
04:57Now it does because it's a new installation that we're bringing data in.
05:02You're going to find all of that placeholder content still there.
05:05It won't remove data that's already there, such as the Hello world,
05:09or if we go to Pages, the Sample Pages, and because I didn't remove sample page before
05:16installation you'll see it twice.
05:18So it's one that came in with the original installation and one that was still in my
05:23data that I imported.
05:24So let's take a look at the site. Now don't be shocked.
05:29But when you first choose it you may very well be, because the first time I saw what
05:33was happening I thought, oh no, I've lost all of that work. Well, you haven't.
05:38WordPress just uses the default theme. It brings in just the content, the posts, and the pages.
05:44It does not bring in your theme.
05:46So you've the option for zipping up your theme folders--both parent and child in our case--
05:51and installing them or just transferring the files.
05:55I'm going to use Finder to copy custom and roux theme folders.
05:59So here are my two sites.
06:01I'm going to extend roux_academy and then go down into blog, and open up content, open up themes.
06:09Here is custom and here's roux.
06:11I'm going to copy both of those and then close that down.
06:16Now this particular site that I have here doesn't use a separate blog folder or anything.
06:21So wp-content is going to be in the site root.
06:23I'll expand, and then just let me double- click on themes to dive into that exclusively and
06:29then I'll paste in my two folders.
06:32Let's head back to the Dashboard, and now I can go to Appearance > Themes, and you'll
06:37see my available themes listed here.
06:40Let's Activate Roux and then head on over to our site one more time, and now our blog
06:46site is back in all of its glory.
06:48There is definitely some clean-up you'll need to do.
06:50Be sure to budget that time in.
06:52I checked all the various sections of WordPress, Posts, Pages, Categories, Tags, and removed
06:58any unwanted elements.
06:59While it's not the most robust solution, WordPress' Import and Export feature definitely fits the need.
07:06In the next lesson I'll show you an alternative approach.
Collapse this transcript
Backing up and restoring the database
00:00Backing up and restoring your database falls into the fact of life category of web professional chores.
00:06In this lesson, I'm going to walk you through the process of exporting your database completely,
00:12and then moving it to another location.
00:14I'll also discuss how you can restore the data to the same database.
00:19So, let's go to MAMP that I have open here and click Open the start page.
00:24So, I can get to phpMyAdmin.
00:26We will use this tool which is found on many web hosts and also accessible for you to
00:33download and install on your own systems at no cost.
00:36So, I'm going to select my roux_blog database here.
00:41This is all the information that WordPress stores. You can see all the tables it creates.
00:47And should you so choose, you can easily choose a table such as posts and then select browse
00:53to see all the information.
00:56But what we're really interested in is going to roux_blog here and then exporting the entire database.
01:03Now, the latest version of phpMyAdmin has an option for choosing Quick and Custom.
01:09The older versions only have the Custom one.
01:11So let's move to that, so you can see what the whole thing looks like.
01:14It's a slightly different screen, but it basically has all the same options.
01:19So, I'm going to select all the tables, make sure those are all selected.
01:22You have two options, one for saving as output to a file, and one for saving output as text.
01:28This time I am going to save the output as text.
01:31We'll keep the format as SQL. Just so you know, there are a ton of other options here.
01:37Then there's format specific options, including displaying comments, et cetera.
01:43Typically, I find that just keeping the default options works well.
01:47So let's scroll down to Object creation options.
01:50Again, if you're moving your data to a different location, such as going from a development
01:55situation to a live server, keep the Object creation options just as they are, because
02:01what you are going to be doing is bringing your data into an empty WordPress installation.
02:07Let's continue scroll down.
02:08The Data dump options, again, keep these all the same.
02:12And when you get all the way down to the bottom, there is a little lonely Go button over here.
02:17In older versions, it's on the right; in the newer versions, it's on the left. So I'll click Go.
02:22And pretty quickly, because we don't have a ton of data, you'll see all that information available to you.
02:28So to demonstrate the process here, what I am going to do is press Command+A to select
02:34everything and then copy it all.
02:36Now, I am going to go back to my localhost, choose Databases.
02:41Let's create another database.
02:42I am just going to call this one roux3. Click Create.
02:46Now, this is in the same situation as if you were just installing WordPress, and it was
02:51going to add all of its database tables and the like.
02:54But instead of running through the WordPress installation, I'm going to select roux3 here,
03:00the database I just created, and go to my SQL tab.
03:04Now, you might think what you probably would do would be go to Import.
03:09You would only do that if you had saved the data as a file.
03:12Because I saved it as a text file and then copied it into memory, I can go right to my SQL tab.
03:18So I'm going to just paste in my copied SQL by pressing Command+V.
03:22Now, before we click Go, you actually want to go all the way up to the top of the information.
03:28In this situation what I will need to do is to scroll over a little bit to the right
03:31so I can see the scrollbar and then grab it and go all the way to the top.
03:35It looks like that's fixed that.
03:38What I want to do is get to the name where it says the Database name.
03:41I am going to change that to whatever database that you're bringing it into.
03:45Now, we exported it from roux_blog, but we want to bring it into roux3.
03:50So, we'll add the 3 there, and now I can go ahead and click Go.
03:55Let's see what it did.
03:59Now again, another difference between older and newer versions of PHP, with newer versions,
04:05you won't get a confirmation message that the data was imported.
04:08So just click the name of the database, and you'll see all of your tables in place.
04:13Older versions put up a mission accomplished type of statement.
04:16Now, we've bought our data in, but we are not quite finished.
04:19There are a couple of really critical chores.
04:21And the first one involves the wp_options table. So, select that.
04:27You want to change two values, the first one is right up top, and it's actually option_id number 1.
04:34And if I go ahead and click on the Pencil Edit icon, you can see that what this is is the site URL.
04:40And you want to make sure to change the path, and I am just going to change this to my roux3 designation here.
04:48You want to make sure to change the path to whatever your new location is.
04:52If it's something that's on the website, you might want to make it something like this.
04:57Now, once you've got the website address up there, copy that, and then click Go.
05:02Now, you copy it because you're going to need to put it in another location, and you want
05:06to make sure that they're the same.
05:08Of course, you want to make sure that they're both correct.
05:10Now, we need to go to the next page in order to see the next item that we have to change.
05:16So, click the next button that you see here, which is just the greater-than sign.
05:21We want to go to item 37 and make that edit there.
05:25So, this is the home URL.
05:28You recall in the General Settings category, we had both a site URL and home URL.
05:32We want to make that they're both the same.
05:34If you don't do this, you'll get into this kind of endless loop where when you try to
05:39log in, WordPress thinks that you're trying to log in to the original URL site and will
05:45keep redirecting you there. So, make sure you make these two changes.
05:49I'll click Go to confirm that option.
05:51Now, there is one more thing that you may need to change, and that's the wp-config.php file.
05:57Let's head back to Dreamweaver.
05:59I am going to extend my Files panel, open it up all the way.
06:04I am going to go into the blog folder here.
06:07The file I'm looking for is the one that WordPress first created when you installed it, and it's called wp-config.php.
06:16Now, don't get confused, there is one that's wp-config-sample which is of course just an
06:23example of how the page is structured. Actually, it's got the information in it.
06:28So, double-click on that, and I'll collapse my Files panel and then go into Code view.
06:33So basically, what you want to do is if you are changing the database name, database username,
06:40database password, or the database host, any of those things on your live installation,
06:46you want to make those modifications here and then upload it to the live site.
06:52This process that I've described is great for moving your database to a new location.
06:56But what about just restoring it to your database?
06:59The process is pretty much the same, except for one switch.
07:03You want to be sure to throw in the export process.
07:06So, let's go back to our phpMyAdmin.
07:08And I am going to select the Database again and then Export.
07:12Now, let's go through the Custom Options one more time because I want to show you that one difference.
07:20And that's in the Object creation options section.
07:24You want to make sure to add Drop Table.
07:28What this will do is before it imports your data, it will erase any table that is there with the same name.
07:36This ensures that you don't duplicate your data.
07:39If you forget to check the Drop Table option, and you've already exported your data, all is not lost.
07:46All you need to do at that point is go back to your Database, Check All, and then with All Selected, Drop.
07:53And that will clear out all of the tables so that you can properly import the data.
07:58It's very important to know how to manage your data.
08:01Many web hosts include the ability to back up your data on a regular basis.
08:05I encourage you to seek out and set up those options with any live WordPress site.
Collapse this transcript
Transferring files
00:00With your site design finalized, you are ready to go live.
00:03Let's take a look at the best way to accomplish that to make sure all of your files get transferred
00:08properly and WordPress works appropriately. The first task is to set up the remote server.
00:14So we'll need to open up the Site Setup dialog box, which you can do most easily by double-clicking
00:21on the site name in the Files panel.
00:24Once that opens up, we'll go into the Servers category where you'll recall we set up a testing server initially.
00:29Now we're going to add another server, so click the Add New Server option, and let's
00:34name this one remote.
00:36This time instead of going to local/network, we'll connect using FTP.
00:41So I'm going to put in my FTP Address which is actually a sub domain that I set up for
00:47testing purposes here, and it's roux.lowerytest.com.
00:52The Port stays the same and put in my Username and Password.
00:59Make sure that you've got the Save check box selected so you won't have to reenter it every
01:03time and then click Test.
01:05Well, good news. We've been connected to the web server successfully, always gratifying to see that.
01:12Click OK, now this is going to a specific directory so I don't need to put in a Root
01:17Directory entry here, but I can go ahead and change the web URL so any link checking will be handled properly.
01:26Once that information is in, that's all we really need to do.
01:29So let's click Save and note that Dreamweaver automatically picks up that this is a Remote
01:34server and then checks that off, that's good.
01:37And let me save this configuration. Dreamweaver will recreate the cache, and once it's finished
01:43we'll be ready to upload the files.
01:45Now to do this, I'm going to go ahead and expand my Files panel, and let's make this pretty big here.
01:50We'll have it take over the whole screen.
01:53When you first come in, you're very likely to have your Local Files on the right and
01:59a blank site on a Remote Server on the left.
02:02Note that there are up top both a Remote Server and Testing Server icons.
02:07You want to make sure that Remote Server is selected, and once that's selected click the
02:13Connect to Remote Server icon.
02:16When Dreamweaver makes the connection, it will show you what files are located in the
02:20directory you specified if there are any.
02:22Since I just set this up as a sub domain, the folder is empty.
02:26Normally, when you set up a site, there may be a couple of files that were established by
02:30the company, including a standard index.html file saying that the site is being set up as
02:35well as some corporate images perhaps.
02:38You want to be sure to remove any and all those files.
02:41Now I'm ready to upload this site, and you might think that I would just leave the uppermost
02:45folder selected and choose Put, but that's going to upload all of the files on the site,
02:51and for our purposes that's not quite correct.
02:54We want to upload almost all the files. In fact, we want upload them all except for two.
03:00To explain what I mean, let's first expand the blog folder.
03:04Now the one file in here that I don't want to upload is wpconfig.php, because I'm planning
03:10on installing WordPress remotely.
03:13One way to avoid this being uploaded is to right- click on it, choose Cloaking, and then select Cloak.
03:19You'll see a red slash through the file, kind of the universal symbol of don't do that, and
03:25here it's telling Dreamweaver not to upload this file.
03:29The other file that you want to be concerned with is within the Connections folder.
03:34The Connections folder was created in the lesson adding WordPress dynamic data to pages.
03:40And within the Connections folder is my connexhibits.php.
03:44Now this has all of the connection information for my local database which may be, and most
03:49likely is, different from what's on your Remote Server.
03:53Now honestly Dreamweaver doesn't really handle this very well. There are third-party extensions
03:57to Dreamweaver which allow you to work with any number of database connections and handle
04:02those appropriately, but instead of installing those, let me show you a workaround that I've developed.
04:08I'm going to duplicate it twice, so I'll press Command+D once, and then again, and you can
04:13see that Dreamweaver appends the term Copy and Copy to the file name.
04:18I am going to change this first file name to connexhibits-local, and this file we'll
04:25just leave alone. This is actually just a direct copy of our local Connection file.
04:30This other one I'll rename to connExhibits remote.
04:34Now this is the file that you would open up, go into Code view, and then change the hostname,
04:41if there is a change, database name, database username, and database password.
04:46Once you have all of those bits of information, save the file. I'm just going to make this
04:53password just to insert something different here.
04:55I'll save that file, close it, and let's go back to our Files panel, and I'm going to expand again.
05:01Well, now I'm going to use my same Cloaking ability for the local files, and I can actually
05:07select them both simultaneously and then right- click and choose Cloaking > Cloak, which should Cloak
05:13both of those files.
05:14And once I close my folder, I'm ready to select all of my files and put them online. So I'll click Put.
05:22Dreamweaver will ask if we want to put up dependent files.
05:24Since I have everything selected, I can go ahead and click No, and it will begin the
05:29process of uploading the files.
05:31Now once the files are transferred, you'll be ready to take the next step which depends
05:36on how you want to bring your data in.
05:39If you want to use WordPress' import/export future, follow the steps outlined in the exporting
05:45and importing WordPress files lesson.
05:49If you'd prefer to go the direct database route, go for the approach detailed in backing
05:54up and restoring your database.
05:56Either way, you'll be able to move your local development to the remote location on your way to go in life.
Collapse this transcript
Testing and fine-tuning
00:00Once you're live site is up and running, there is still a little bit to go.
00:04It's pretty much critical that you do your own testing and especially with the WordPress
00:09based site engage your client in the testing process as well.
00:14So I like to think of it as divided into two main areas, your own testing and then client-based testing.
00:22Your own testing should initially address the public-facing site.
00:26You want to make sure that all of your output is cross-browser, cross-platform, and especially today, cross-device.
00:35One key tool that you can use to help ensure that your site is both cross-browser and cross-platform
00:41is Adobe BrowserLab, and it's something that you can access right from within Dreamweaver.
00:46Now you also want to be sure to test your administrative site, and by that I mean the WordPress Dashboard.
00:55For the most part there is been a lot of testing that is already gone into making sure its
00:59cross-browser and cross-platform tested well, so you really only need to do a little bit of that.
01:06However, I do recommend that you look at your WordPress site on a variety of platforms and
01:11browsers just to ensure that there are no surprises.
01:15When it comes to different devices like tablets and phones, that area is under development
01:20as they say, and I would especially test hard on any enhancements that you bring to your
01:25site as we did earlier in the course, especially in the cross-device category.
01:30You want to make sure that any menus that you've added to the Dashboard are easily accessible
01:36on both phone, tablet, and desktop.
01:39Another aspect to testing and fine tuning your administrative site is making sure that
01:45the client assistance and support is in place.
01:48It's one thing if your client is well versed with WordPress blogs and has worked with them
01:53for years and all of their company have used them for years, but that's not always the situation.
01:58I typically encounter clients who are new to using WordPress and need a lot of support initially.
02:05What I do is I create some basic targeted documentation that includes their log-in details
02:11meaning the URL that they go to in order to log in, what their usernames and passwords
02:17are, and how to find them if they don't have them available to them, and then just the
02:21basics of entering posts and editing posts.
02:25I try to set up my WordPress site so most of the hard work--meaning setting up different
02:30pages with different themes--is already done.
02:34And the client only needs to do a bare minimum, such as enter a post and assign a category.
02:41On the client side of things, you want them to also be concerned with testing the public-facing
02:46site, as well as the Dashboard administrative site.
02:49With the public-facing site, you're going to be dealing with real-world browser, platform,
02:54and device testing.
02:55And by that I mean they're going to be using exactly what it is that they work with in their everyday lives.
03:02I always try to find out ahead of time what browsers and systems people are used to working
03:08with so that I can be sure to pretest those a little more heavily than I would other devices.
03:14I want to make sure that when the client sees the work for the first time, that it looks
03:18exactly as they're expecting it to.
03:21That being said, you never know when they will get word from a trusted advisor who's
03:25on an Internet Explorer 6 platform that the site doesn't look quite right.
03:30So you have to be prepared for situations like that, whether you build in the expectation
03:35of what browsers, the sites we'll work on in the contract or less formally.
03:40One thing that I found very helpful when working with clients and WordPress sites is to initiate
03:45a soft launch so that the site is launched but only the client's personnel have access to it.
03:52So that they can see not only what it looks like under real-world circumstances as they
03:57add more content and expand certain areas of the site,
04:01but also so that they can get their content onto the site before it officially launches.
04:06One of the most frustrating things from a web designer's perspective is often getting
04:10the content that a client intends to put on the site ahead of time so that you can incorporate
04:16that correctly and see what it is they're really working with.
04:20Having a soft launch allows them both the experience of getting used to working with
04:25the site so you can answer any questions in an upfront manner as well as populating the site.
04:32Typically during this process, you'll encounter some minor bug fixes and some adjustments
04:37where one feature may not work out exactly as they had thought and so they want something slightly different.
04:43Now that's all fine.
04:45But one thing I want to caution you about, this is also an area where feature creep can come in.
04:50You want to be aware of the possibility of that but also alert for ways to take that
04:56desire to enhance the site into an opportunity for future work.
05:00Now there is a tremendous amount of gratification in seeing a client make the site their own
05:06by adding content and bringing your site design to life.
05:10Enjoy your work as it takes off and becomes an important destination on the web. [00:05:15ll.91]
Collapse this transcript
Goodbye
Next steps
00:00Thanks for watching Dreamweaver and WordPress: Core Concepts.
00:04I hope you found the lessons to be both informative and engaging.
00:07If you'd like more information on working with Dreamweaver and WordPress, check out
00:12my related courses here in the online training library at lynda.com.
Collapse this transcript


Suggested courses to watch next:

WordPress: Building Responsive Themes (2h 55m)
Morten Rand-Hendriksen



Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked