PDA

View Full Version : writing a page?



billbenson
07-09-2009, 03:26 AM
I'm completely new to wp. I have a zen cart site with the catalog as a subdirectory and a static index page and a couple of other pages in the root directory. I want to use wp to replace those static pages at the root level and add more. This seems like a fairly simple way to get my feet wet with wp. I have a template that matches the zen cart pretty much. Changed colors etc last night, added logos...

The template is very basic. Header, footer, left nav, body to the right of that.

I want to write a very simple index page which will have images on the left and a description of the image product to the right.

This is fairly simple to do by adding a html table where you write the page in wp admin. The pages could potentially get a lot more complicated over time.

The question is this: should I be doing this in tables or using div's?

I think I know the answer, but I wanted to see how others are doing this.

Patrysha
07-09-2009, 11:22 AM
If I understand what you are doing correctly...then I'd be doing that with a different sidebar file for the page.

vangogh
07-09-2009, 11:31 AM
You probably know if I were coding it I'd be using divs and css as opposed to tables, unless of course the page in question will be presenting tabular data.

It's really up to you though for how you go about coding the single page. Since you're trying to get your feet wet with WordPress, I'd say code it however is easiest for you. That way you'll be able to learn more about WP and how it works and not have to spend time worrying about the code.

Down the line what you could do is develop a new page template specific to the image/description format and even create a plugin that would let you enter both the image and description for single products into the database along with some extra info that would let you specify which page the image/description should be used on.

But for now, you're fine setting things up as a table as you create a new single page, though I'd still probably use css.

billbenson
07-09-2009, 04:49 PM
Patrysha, I'm just talking about the content section ie where you fill in the form for a blog or page. The page sidebar which is part of the template would not change.

VG, that's what I figured you'd say :). CSS is definately one of my weak points which is why I want to do this in CSS. The actual post / page is quite simple, so its a good starting point.

Keeping this to the equivalent of a 2 col 5 row table for now, I was thinking of simply adding a couple of classes at the end of the css and using those for this and do the layout with div's. To do this, should I use relative positioning or floats. I'd like to keep this theme independent. Using a table should be pretty much theme independant. Would doing it with css also keep it theme independent?

vangogh
07-09-2009, 05:39 PM
Positioning sounds like the better approach, but floats are usually the way to go.

What you could do is simply create a paragraph with the description. At the start of the paragraph add your image and give it a class of alignleft (I assume the images will be to the left) The reason for that class name is because it's the one in the default theme and many other themes end up using the same name. Also if you upload an image through the media icon and tell it to align to the left you'll see it gets a class="alignleft added".

If your description does go vertically more than your image, you're probably all set. If the description does go beyond the bottom of the image it'll wrap below the image, but we can easily fix that.

So let's assume instead of uploading through the media link and instead of going with the default class name, you've gone with a new class name (floatleft) specific to these images. Here's the html I would use.



<p><img clas="floatleft" src="path-to-product-image" alt="Text describing image" />Your description for the product here here.</p>


and the css



.floatleft {float: left; margin: 0 10px 10px 0}


You could use img.floatleft if you want, but you shouldn't need to. The margin is shortcut code and the numbers are for top, right, bottom, left, respectively (think of the word trouble to remember the order). I used 10px, but you could use whatever you like.

Above I mentioned how the description text would wrap if it goes beyond the bottom of the image. That includes the margin we added to the image so the text would need to go 10px below the image before it started to wrap. You could simply increase that so the text would need to be longer before wrapping.

While none of the above is really a column it should still achieve the look of a column with images on the left and text on the right. If the images are all the same width it'll work great. If the images are different widths then we'll have to come up with some different css, but I figured it was best to start with the simple.

I think the keep the css theme independent you need a plugin. There's at least one, maybe more that let you add css to the specific page or post only. It does that by using custom fields which you should see below the area where you write the post. If you can't find the plugin let me know. I'm sure I can find it for you.

billbenson
07-09-2009, 06:35 PM
Thanks VG. I'll start with that.

However, what I have is:

image1 Descritpion for image1
image2 Description (paragraph) for image 2
image3 Description for image3
etc.

will the float left for each image keep the description paragraph for that image next to it?

I'll start playing around with it shortly. Phone calls are done for my sales day...

billbenson
07-10-2009, 12:14 AM
That worked VG, but I want to play with it some more. A couple of unrelated questions however:


I have a template that has top and side Nav. I'd like the pages to go into category -> pagename in the left column. I read that pages don't have categories. Is there a way to add categories to pages?
The default location for images is under your theme. This means that if I play around with different themes after having some content, my images will only show up under the original theme. Does it make sense to add an images directory under the root and use that. I realize that that would prevent the image uploading feature from working unless I modified the code.

vangogh
07-10-2009, 01:05 AM
Unfortunately categories are for posts and not pages. What you can do is create a hierarchy of pages. You would set up a page called Category and then a page called pagename. If you look to the right, just below where you publish the post there's a dropdown under the Attributes heading that will let you choose a parent page for the new page. So you'd select Category as the parent for pagename.

Your theme may not be coded to display the hierarchy the way you want though it could be coded to display it that way. I think there are some plugins that will also help set up the navigation.

Another option would be to make those pages posts and categorize them as you would with posts. Then when displaying your navigation you could tell your theme to display only certain categories in one place and certain categories in another.

Your images can be anywhere you want. The images specific to displaying the theme will stay in that theme's folder, but every other image can be anywhere you want. If you use the WordPress media link to upload images, by default they'll go into an uploads folder inside of wp-content, but outside the themes folder. Usually you're images will go inside folders specific to the month and year inside the uploads folder, but you can change that if you want.

billbenson
07-10-2009, 02:50 AM
back on the floats. Your code works fine, but the text wraps. That's actually fine, but just so I know how to it; if I want to have a true table style. That being image - description to the right. Next image, description to the right (I wasn't able to get the images to line up with the descriptions text), how would I do that?

vangogh
07-10-2009, 10:54 AM
Could you send me a link to the site via PM? I may need to take a look at the code to see what's going on and how to fix it.

My guess is it's something in the margins or padding that's not letting things line up, but it could be on any of several elements so it's hard to know which.

billbenson
07-10-2009, 10:14 PM
I only have it running locally right now. When I get it finished, I'll upload it and send you the link. The wrapping text actually looked better, so getting everything to line up for this page was really just educational.

billbenson
07-10-2009, 10:29 PM
What do you do for SEO in wp VG. I know there are some plugins. From all the sites I've looked at, I haven't been impressed with the SEO (on page). the template I have has multiple h1's for example, one being the title of the sections in the nav column. That's a big no no IMO. It seems like its going to be pretty easy to defeat or write some work arounds. Just curious what you do.

vangogh
07-12-2009, 01:31 PM
Do you mean what do I do with each individual post or what do I do with the whole site?

On the whole site I'm developing the theme so I can replace poor code for good. I would only use one h1 per page, though I tend to think there's minimal value in hx tags when it comes to seo. For on page stuff I might research keywords prior to writing a post. Nothing extensive, but if I know a post is going to be about 'blue widgets' I might drop the phrase into one of the free tools just to see what other words people use in combination with the phrase 'blue widgets' and then keep those words in mind when writing.

I generally think keeping the words you want to use in mind while writing and using your primary phrase in your page title are enough when writing a post. Maybe later I might experiment by adding the phrase in one more time or changing the title around a bit. I do want to use alt text on images, but even then I'm less thinking about getting in a specific phrase and more thinking about describing the image appropriately.

Overall with the site I will always set WordPress to use a custom permalink. Usually I go with /&#37;category%/%postname%/, but sometimes I may eliminate the category. I'm just thinking about how to best organize and structure the content and really I'm doing that more for usability than seo.

With the URLs of the posts I'll eliminate the unnecessary words, though in all honestly I forget to do that more often than I should. With the plugins I have a few installed to allow me to make the page title different from the post title (which is the h1), but I don't use them that often.

Most of the time when writing a post I'm more concerned with attracting real people to it and getting them to click into the post to read it, than I am worrying about how it's going to do in search engines.

I know you like to cross all your t's and dot all your i's when it comes to on-page seo, but I think the time spent doing that could be better spent doing other things. I think if you generally keep your content on topic throughout a post, keeping your main keyword phrase in mind while you write, it will naturally include the right amount and variety of keywords.

When I see older posts ranking well around a theme I know my site has enough authority to rank well for similar phrases so it may lead me to write another posts on the same topic. The new post might use a more generic phrase. If the first post ranked for 'shades of blue widgets' the new post might target 'shades of red widgets' or just 'blue widgets'

I'd sooner spend time promoting a post than worrying too much about dotting every i and crossing every t. I think there's better ROI in the promotion and later if I want I can go back in and tweak the content based on what the posts is already ranking for.

billbenson
07-12-2009, 03:12 PM
It's been a couple of nights and I was just playing with css and the template for a few things. I think there are a couple of tags that are worth utilizing. In order of priority Title, H1, H2 (and at times other headings). I think it really slaps Google in the face and says "this is what the page is about and given good content it's important IMO. After that, I'd go with the natural flow of the page. What I saw multiple H1's or a poor title, I think "what a waste of an important tag"

The default setup seemed to be using the same title on all pages. Then there was the H1 that came up as the page title and and also the page link. I didn't think much of that. Remember, at this point, I am just playing. I believe what I did is take out the page title altogether and get rid of the H1's for that which would be empty at that point. I don't think I did anything with the title, but something needs to be done about that.

Beyond that, everything else can be done in the post. Getting a decent description in there would be good and the meta keywords I don't usually bother with although if it only takes a couple of minutes in most cases and it falls into the why not catagory. I would only use one or two keyphrases..

So its really just dealing with the title, h1, and other heading tags that concern me and much of that can be done in your html content if you make a couple of mods to the template from what I can see.

Having said all of that, I really haven't given it much thought as I was more trying to figure out what is where etc.

vangogh
07-13-2009, 10:40 AM
I agree the title tag is important. It's probably still the most important words you'll write for any post. As far as the hx tags are concerned lately some people have been testing and their results would indicate there's little to know correlation between what's in your h1, h2, etc tags and how well your page ranks. Now I'm still going to include the tags. They are important to show the hierarchy of our content and they're an aide in reading. And I'm still going to use keywords in the hx tags where it makes sense. But I don't worry about it too much.

Your theme default may be using the same title across all pages. That's something I would change. You can code the header.php file to display the title dynamically depending on which type of page/post someone is viewing.

Title and headings will be set up in your theme files. Naturally the content for each will come from the content itself, but in general you'd probably code the tags in your theme.

billbenson
07-13-2009, 08:35 PM
I wrote a novel response, but the forum erased it... Anyway, I agree on the title tag being extremely important. I think cms's, templates, and bad code has hurt hx. I think a h1 used once and only once to describe the page and hx's as subheadings is important, but particularly h1's. The problem is, how many poorly used h1's have you seen? ie <h1></h1> or used all over the page including images with no alt?

If you blindly put up a cms or template, it may be doing things that hurt you?

I see that as an opportunity to make it help ME!

vangogh
07-14-2009, 12:19 AM
I think it's more that people spammed the hx tags. You can still find advice to make all your tags h1s because h1 is better than h2. Lot's of themes come with an h1 tag wrapped around the logo, which was another trick people tried.

When it comes to on page content I really try to write the page to benefit the person reading it. I'll use headings because they aid in reading and present a hierarchy to the content. If it helps a search engine understand the content so much the better, but my focus is still on usability. The good thing is making a page and site more usable usually also makes it more search friendly so it's a win all around.

I agree about putting up the CMS blindly, though sometimes it's more the theme than the CMS itself. One of the reasons I like WordPress is because it is pretty search friendly out of the box. If you set permalinks and have a decently coded theme you're already ahead of most sites. One of the problems with free themes is they aren't always coded in the best way. Some are done well, but most I've seen aren't. The emphasis seems to be placed all on the graphics, since that's all people usually see before downloading.

billbenson
07-14-2009, 12:54 AM
I'm kind of bouncing back and forth here, but then again I consider, css, layout, theme editing, and seo to all be interrelated:

You mentioned earlier in this thread that the reason I couldn't get a two column "body"style for my post may be related to padding in the css. I noticed that the theme I had used padding and floats as the primary means of "positioning" elements on the page. Do you consider using padding extensively for this purpose good design practice or are there better ways of doing this.

I used the long beach wp theme, mostly because it looked easy to edit and had left and top nav.

Best Free Wordpress Themes (http://bestfreewordpressthemes.net/preview/?pt=Long%20Beach)

Business Attorney
07-14-2009, 11:27 AM
the template I have has multiple h1's for example, one being the title of the sections in the nav column. That's a big no no IMO.

Matt Cutts says that multiple H1's are not a problem, at least within reason.

YouTube - More than one H1 on a page: good or bad? (http://www.youtube.com/watch?v=GIn5qJKU8VM)

vangogh
07-14-2009, 11:41 AM
Bill can you send me a link to the theme?

When I layout a site I do use margins and paddings. Mostly I'll float elements and then use margins if they need to be moved a few px one way or the other. I'll also use margins to create a vertical rhythm to elements. I try to use padding more to create whitespace inside an element. Overall both margin and padding can be used to effectively layout a site.

Of course that doesn't mean the theme in question used them well.

David I've seen Matt Cutts say that. My view on using one and only one h1 per page is more about usability. If you think of a web page in the same sense as the chapter of a book then the book has one title per chapter and then several subheads within the chapter. The h1 is the most important heading on the page and should be reserved for the page title. If you need more headings you should go down the hierarchy and use h2, h3. And with very little exception you probably don't need to go below h3 to organize content on a page.

Business Attorney
07-14-2009, 11:54 AM
David I've seen Matt Cutts say that. My view on using one and only one h1 per page is more about usability. If you think of a web page in the same sense as the chapter of a book then the book has one title per chapter and then several subheads within the chapter. The h1 is the most important heading on the page and should be reserved for the page title. If you need more headings you should go down the hierarchy and use h2, h3. And with very little exception you probably don't need to go below h3 to organize content on a page.

I agree with you and never have used more than one h1 on a page (at least that I can recall).

Since Bill was talking about WP's on-page SEO in his preceding sentence, I read his statement as meaning that using more than one h1 was a no-no from an SEO standpoint (which seems not to be the case) rather than a design no-no.

vangogh
07-14-2009, 12:32 PM
Agreed. Though be careful sometimes when interpreting Matt Cutts. In the quote you pulled notice it ends with "at least within reason" That leaves a loophole of what constitutes within reason. Most site owners will never have a problem, but those that try to make use of the h1 for seo by wrapping every keyword on the page in an h1 or only using h1s for all headings might no longer be within reason.

A few weeks ago SEOmoz talked about Correlation and Causation in SEO (http://www.seomoz.org/blog/whiteboard-friday-correlation-causation-seo) in their weekly Whiteboard Friday video. This one is about 15 minutes long. SEOmoz has been indexing the web and collecting a ton of data. One of the things this video mentions is how they aren't seeing any correlation between hx tags and rankings.

That's not necessarily proof of anything, but the indication seems to be that hx tags really don't make a difference when it comes to ranking.

The video is interesting and worth a look.

billbenson
07-14-2009, 01:37 PM
It's the theme entitled "Long Beach" at this link:

Best Free Wordpress Themes (http://www.bestfreewordpressthemes.net/)

My concern in using margins or padding for layout is if you have dynamic content on a page. To my knowledge wp doesn't support php in posts, but there are plugins that allow it. A long piece of text presented dynamically could potentially have some layout issues?

David, I agree with VG in treating the h1 as a chapter title as well as the rest of his description of the other heading tags. There's nothing technically wrong with multiple h1's, but it doesn't make a lot of sense and seems to me it would dilute the value of the h1.

The same is true for trying to optimize a page for multiple keyphrases instead of just one. Google is going to say "whats this page about?".

vangogh
07-14-2009, 02:11 PM
I just downloaded the theme. When I get a chance I'll install it on my development server and take a look. Thanks for the link.

You're right about needing to use a plugin to execute php inside a post. I think one of the better ones is called exec php or something like that. You should be able to search for plugins through the admin side of WP.

If a page/site is developed well there's no reason why the padding and margins would break the layout even if the content is dynamic. If there are layout issues then the design was made to handle it or the development needs to be improved. No reason why it would have to break the layout though.

billbenson
07-15-2009, 11:39 PM
Quick plug in question then. This is the first one I've tried to install. When I unziped it, I got a bunch of linear files and directories in the same folder rather than a folder named exec-php and other directories and files below it which is what I would have expected. The directions elude to just one folder after unzipping. Should I create a folder called exec-php and put all the other directories under that (including css etc)?

vangogh
07-16-2009, 12:41 AM
I just checked the exec-php plugin and yes you would place all the subfolders under one exec-php folder inside the plugins folder. Just grab the main exec-php folder and move the whole thing into wp-content/plugins/

So you'll have

wp-content/plugins/exec-php/folder1
wp-content/plugins/exec-php/folder2
wp-content/plugins/exec-php/file1
wp-content/plugins/exec-php/file2

etc.

There's actually an easier way to install plugins now. When logged into the backend of WP look for the link under the main Plugins menu called Add Plugins. You can search for a plugin and just click to install it from the results. If you search for a plugin by name it should appear in the results. Some may not if they aren't in the WordPress repository.

By installing through the admin, everything will get loaded where it should without having to think about it. That functionality came in WordPress 2.7. WordPress 2.8 does the same thing for themes.

billbenson
07-16-2009, 05:52 AM
Well an echo statement worked. Maybe tomorrow I'll try to select something from a db and see how that goes.

Didn't try the auto install as my password didnt work. It's '' running locally and maybe it didn't like no password.

If db selects work, it could be a really useful plugin.

vangogh
07-16-2009, 11:27 AM
Oh yeah. If it's running locally you probably do need the manual install. I would think it would work for db selects. I never tried one with it, but it did work for all the php I used.

billbenson
07-16-2009, 04:03 PM
It works with selects as well. Since I am running ZenCart on the site, I can switch databases and use a zen product description as part of a wp post. I tested it. Could be some interesting applications.

vangogh
07-16-2009, 04:19 PM
I probably should have mentioned that plugin to you a long time ago. I bet it'll be one of the ones you're happiest with given what you do.

billbenson
07-21-2009, 12:50 AM
Understanding Themes

I'm getting a little bit ahead of myself here but... This is my first WP site and I am strictly using it as a site structure not a blog. I picked a theme because it had top and left navigation so I could adapt it more easily to a zen cart style I have.

Although you can use pages to make a site style with WP, that seems to complicate left column Nav a lot. What I've done is modify all the appropriate template pages so it appears as a site, not a blog.

Question: for site style with wordpress, is it usually done that way within the theme. If so, should I have looked for a site style theme? Or, are there plugins for this sort of thing that handle the nav problems etc?

If I want to have a site style site, but also a blog, do I take a theme I like and modify one version of the theme for the site and use the other version as the blog? In other words have one WP install, but use two themes depending on the posts? I'm getting way ahead of myself here, just curious if that's more or less how its done.

vangogh
07-21-2009, 02:32 AM
You'd use the same theme for both. Different files inside the theme folder control each. single.php is what your posts will look like and page.php is what your pages will look like. page.php is actually the default page template. You can create as many as you want.

For example say you want your pages to have a sidebar, but you don't want to have that sidebar for your contact page. You create a new file called contact.php and place all the code from page.php inside it except for the call to the sidebar [ get_sidebar() ] Then when you create the content for the contact page on the admin side you select to use your new file as the template for the page. You can select the page template on the right hand side below where you publish the post.

You can also make additional sidebars and include them as you would any other php file. I'm using several different sidebar files on my site now and including them based on which page or post you're viewing.

In your case since you aren't going to have a blog at the moment you'll want to edit page.php. The file should call the header, footer, and sidebar so you'll want to work on those files too. There shouldn't be a problem with the menu, though it depends how the theme is coded.

What specifically is the problem with the navigation? Are you trying to create a subnav in the left column with the main nav across the top?

The easiest way to do navigation in WordPress is to use one of two template tags

wp_list_pages (http://codex.wordpress.org/Template_Tags/wp_list_pages)
wp_page_menu (http://codex.wordpress.org/Template_Tags/wp_page_menu)

It's a good idea to get to know Template Tags (http://codex.wordpress.org/Template_Tags/) in general. Each is basically a function call that exists in WP.

The two functions above are the ones you'll typically use for navigation and you have some measure of control by passing different attributes to each tag. For example say you are creating subnav in the left sidebar and you only want to show pages under the widgets category. You can use the child_of parameter and set it equal to the id of your main widget page. Then the subnav on that page will only show the pages that are children of the main widget page.

billbenson
07-21-2009, 04:09 AM
Great post VG. I'm going to have to reread it a few times...

So I did exactly the opposite as to what you recommended. I rewrote the post pages to look like a page as opposed to add into the page file the site style stuff I wanted.

I'm glad I did it the way I did, as it forced me to scrounge around and see where stuff is rather than get lazy.

Really helpful post though, thanks.

I'll give some thought as to any tutorials you may want to write. What comes to mind offhand, is that most tutorials show you how to do something, but they really don't explain why or the proper way to do something and why that matters.

vangogh
07-21-2009, 11:59 AM
Glad to help. Sometimes doing that stuff wrong at first actually gives you more understanding for next time.

Thanks in advance for tutorial ideas. I usually try to explain the why when I blog. I'm with you in thinking the 'what' doesn't go far enough. I'd rather teach someone to fish than give them some fish.

billbenson
07-23-2009, 01:39 AM
Tutorial thoughts

I learned php from php / mysql for dummies years ago. It was a good book that got me writing php/mysql in two weeks of one hour a night. The thing is, it left all kinds of holes in my knowledge. To date, I've been able to get everything I need working though, which is kind of cool. WP uses a lot of shortcuts for writing code, some of which I wasn't familiar with. As I find stuff I don't understand, I look it up. Part of the educational process. I also may want to study Object Oriented Programming, although that may not be necessary for what I do.

I would bet that a large percentage of developers and programmers have this problem. As an industry, most are self taught. I bet you couldn't find a college program on SEO. There are some certification programs out there for web design, but there aren't really any college level programs on it. Closest thing would probably be computer science, but that won't tie in the marketing aspects. As for the certificate programs, I've seen some of the work produced by them and its pretty bad.

So, if my assumption that most web developers are self taught is correct, I think there is a big void in intermediate level tutorials, references etc. I am referring to html,php, css, and maybe js (I just tend to do everything server side so I don't put a high priority on js although it certainly has its place). Then there are things that are fluid like seo, marketing, fixed vs fluid layouts, what computer resolution does your target market use...

So, in summary of the above, I would target the intermediate user and assume they may know stuff that surprises you and don't know stuff that also surprises you.

As for the tutorial mechanism, I think it needs to be designed around something that people can do in an hour every night or two. Small classes if you will. Has to keep their interest though. A blog for this could allow users to post their solution for review by you and their peers. I realize you don't have time to review every one, but maybe guide a sample pupil through things. Give classes of sorts on your blog and when a pupil gets it right they move on to step 2. If you could automatically incorporate some w3 code checking and cross browser checking of their code that would be really interesting.

I understand that much of this is more than just writing tutorials off the top of your head, but...?

So small simple classes aimed at intermediate web developers. Not core dumps of bland information though.

vangogh
07-23-2009, 02:14 AM
Thanks Bill. Interesting thought. I'm pretty much self taught too. I usually pick up a few books on a subject, find some online tutorials and then the rest is me trying to solve real problems. I've noticed the intermediate tutorials always seem to be lacking. You can always find beginner books and advanced books, but the in between stuff often is missing.

What you're talking about is more than the usual blog post I think, but that's fine. I actually would like to write longer tutorials or series of tutorials as part of a course as opposed to a one off post.

billbenson
07-23-2009, 04:23 AM
One other thought. I spent some time tonight trying to figure out wp. Tons of info, but again its "do this" not "this is how it works.

Some custom design wp stuff actually explaining what is happening. I picked the line of code below at random, but...


<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

The modifications I've seen on tutorials say "delete this piece of code". I saw a forum post where the poster said he had to delete it rather than comment it out, because commenting didn't work. He probably commented the html line, but not the php inside. Gotta do both.

The wordpress tutorials leave a lot to be desired at the intermediate level as well.

I'm just throwing ideas out here. Nada mas.

vangogh
07-23-2009, 11:52 AM
What were you trying to figure out? Can you point me to where you found that line of code?

I hear you about it being a lot more recipe and a lot less explanation. I see that all the time. There are some good tutorials out there, but more are probably the recipe kind.

billbenson
07-23-2009, 02:28 PM
That line of code came out of the Longbeach template I'm currently using. I think index.php. I just used it as an example in my post because it intermixed html and php functions. I wasn't doing anything with it.

I don't remember any WP solutions when I searched for something that explained how php functions work, that they can take on parameters, that in a line of code like this that you are popping in and out of php / html and why. No decent explanations on commenting stuff out instead of deleting it.

I just found "change X code to Y code and your done". Strikes me that that leaves a good niche for writing tutorials, particularly in the cms world. I bet there are a lot of cms users that aren't afraid to go into a script and change the code, but really don't know why the changes they are making work. They just found a "do this" solution somewhere in a G search.

vangogh
07-23-2009, 03:42 PM
Gotcha. Good to know. I usually try to do my best at explaining the why in any blog post, but you're giving me some ideas for series of posts to run as a more full blown tutorial.

Thanks.

billbenson
07-25-2009, 03:53 PM
ok, back to wp. I made a new page template. I added wp_list_pages to the sidebar.

The template I have put pages in the menu across the top. I want to put a couple of links in the menu, but only a couple of pages. About, Contact Us, etc. I also don't want those pages to show up in the wp_list_pages in the sidebar.

Whats the best way to do this?

vangogh
07-26-2009, 11:55 AM
In your case the easiest thing will be to use the include and exclude parameters of wp_list_pages() (http://codex.wordpress.org/wp_list_pages)

Say your About and Contact Us pages have ids of 4 and 9 respectively. In the menu at the top you could use

wp_list_pages("include=4,9")

and in the sidebar use

wp_list_pages("exclude=4,9")

You'd also use any other parameters you'd like. For example you probably don't want the menu at the top to show a title so your code might be

wp_list_pages("title_li=&include=4,9")

There are ways to dig deeper into WP and make the menus more dynamic, but I'm thinking you'll always know which ids you want to include and exclude and are fine updating the code to include or exclude new pages when they're created.

billbenson
07-26-2009, 02:31 PM
Gocha, Thanks, makes sense.

Out of curiosity, have you ended up making some of your own includes or have you been able to do everything you need with the standard ones?

vangogh
07-26-2009, 02:50 PM
I've done both. I prefer to work within the system as set up by WordPress since it usually makes updating easier down the line, but sure I'll use a simple include to other files all the time.

Say you want to show two different sidebars depending on the page you're on. You would make a second sidebar and there's no reason why you couldn't include that file via the usual php include statement. The more I get into WordPress though, the more ways I find to not have to do this. WP provides plenty of conditional so you could create one sidebar and have some information show only on certain pages.

Which solution I would choose depends on what I plan on doing with the theme over time and which solution seems to make the most sense under the circumstances.