I need some help from designers with Wordpress Experience., page 1


Pages:
ATS Members have flagged this thread 2 times


reply posted on 15-3-2007 @ 07:43 PM by dbates
Just to show you what you can do with wordpress, most of my site is now run off this software. (I love it)

Once upon a time I had static HTML pages. Then I added a wordpress blog. And then I made my other pages categories in wordpress. My site index page (and several others) are modified to read from the wordpress database. Shoot! Even my signature here has my latest post I made with wordpress at my site.

Don't give up. I ran into a few frustrations at first too, but WordPress is so worth messing with. There's so much you can do with it.

Have fun.


reply posted on 16-3-2007 @ 11:14 AM by dbates
Let's break this down line by line"

$this_page_comment = $_GET['p'];
$this_page = $_GET['paged'];

Here I'm checking the URL to see if someone is requesting to see a specific page number or a specific post. Without this ability you won't be able to do next page or add comments easily. Now that we have this information we're going to ask WordPress to hand us the information we want.

if(!empty($this_page_comment)){
query_posts('cat=9&p=$this_page_comment');
}
else if(empty($this_page)){
query_posts("cat=9");
}
else{
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("paged=$paged&cat=9&orderby=date&order=DESC");
}
$this_page_post_count = 0;


So we make one of three queries. We either ask for a specific post, a specific page, or just all the information. I'm asking for category 9 only in this case. If you leave that out you'll get all information. So "query_posts()" would return everything. In the same manner query_posts(-9) would return everything but the items in categtory 9. This is all fairly simple unless you want to filter out more than one category. Sadly you can't filter out more than one category. Insted you have to ask for every category except for the few you don't want to see. I haven't had to do that yet, and hopefully you won't either.

You can do more fun things like filter by year and month. "query_posts(&year=2007&monthnum=2)". I dont' remember every single possiblity, but the odds are that if you want to do it, someone has done it before.

if (have_posts()) : while (have_posts()) : the_post();

This is the main loop for all WordPress pages.

akpc_the_popularity();

A plugin I'm using. Exclude this line.

$this_page_post_count = $this_page_post_count + 1;

I'm keeping track of entries and later you'll see that I'm stopping once I get to 10. My way of showing only 10 items at a time.

Now we're in a specific post so I get the post date and title for display. I add in an edit link, which only shows if you're logged in as an admin.

the_content(__('(more...)'));

This code displays the content of the post entry. Now let's add in links for people to leave a comment.

wp_link_pages();
comments_popup_script(625, 625);
comments_popup_link(__('Be the first to comment on this'), __('Read comment or leave one yourself '), __('Read the % comments or leave one yourself'));

I specified the size for pop-up page comments. Then I defined the text of the comment link. You supply three values One for uncommented items, and two for items with comments. (I dont' remember why at the time)

comments_template(); // Get wp-comments.php template

Self explanitory

endwhile; else:
_e('Sorry, no posts matched your criteria.');

This is the end of the main loop. The part after "else" is text I write out if there were no matching post for the query made earlier.

In the next part (if(empty($this_page_comment) ) we make a decision to include a link for older or newer entries if needed.

That's all there is to it. I don't have a sidebar or header for this page, but if you download someone's template you'll see how it's easily done. Usually the header, sidebar, and footer are in their own php file. This is how it's done on my actual blog page. I just call get_header(); and get_sidebar(); before the posts. Then I call get_footer(); at the end.

[edit on 16-3-2007 by dbates]
Pages:     ^^TOP^^