This week I wanted to create a page that would hold all of the blog posts that I made in the category ‘Portfolio’. I didn’t create a portfolio page because I wanted to be able to add a post each time I had a new item to add to my portfolio.
<authors note: I have about 100 things to add to this portfolio. If you would like to see my complete portfolio, please visit my website, CimmeronStudios.com>
So, I hit the Wordpress CODEX to dig into the best way to create a page that would display posts based on whatever variable I wanted to add, in this case, the category ID.
To begin, be sure to create a new TEMPLATE for your page. To achieve what we want here, we want to MODIFY the existing LOOP. Now, the LOOP is basically what powers your Wordpress site. Here’s the very basics (taken from Wordpress.org)
The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags.
For a very detailed explanation of the LOOP, check out the Wordpress Codex.
So, back to our page. I’m going to run through this in a step by step fashion.
1. Create a new page template. You can do this by taking the existing page.php and saving it as a template, such as template-portfolio.php. To do that, you will need to remember to place a bit of code at the top of the page so that WP recognizes that it is a template:
2. Locate the following line of code on this new template page:
3. Next, we will alter this part of the code to display only what we WANT to have displayed. We will do that by using a query:
There are a TON of variables that we can use at this point, however, I’m going to use just 2 for this example. Category ID and Number of Posts to display.
The Query has to be added before the loop to make this work, so you will insert your Query like so:
The highlighted area (above) shows you where you’ll be adding your information. Basically, the area between the ( and the ‘ ….
That is where you tell the page WHAT to display. In my example, we have:
5 posts will be displayed on this page
Next we have the important one:
This means that ALL POSTS from Category ID number 19 will be displayed.
You can change this by using the Category name, as well:
After you change out your Query values, you can upload the template to your server, go to the PAGE and assign it to that TEMPLATE – That’s all there is to it!
Here are a few other items that you may want to use when customizing. REMEMBER: You can string multiple variables together by using the & as long as you keep everything within the (‘ ‘):
That should be enough to get you what you’re after. Any questions? Feel free to send me an email or comment below!
First off, Godaddy is NOT my favorite company for domains/hosting/etc. The interface makes things more complicated than necessary, installing programs can be difficult and sometimes direct FTP access via Dreamweaver or Filezilla won’t work.
That said, their customer support is always very helpful!
So, I had a website that needed to be built with Godaddy hosting while leaving the existing site (pointed at a different DNS) live. I wanted to be able to preview the domain as I built it on the server without switching the DNS.
Usually, this is easily done if you’re using hosting such as Bluehost. Godaddy – not so easy. After looking around online for a bit, I decided to call Godaddy and see if they could help. This is what I found:
Login to your Godaddy account and click on HOSTING on the left sidebar menu:
Next, you’ll see the hosting manager. Click on ‘manage account’:
This will open a new window with your hosting account summary. Towards the bottom, you’ll see Primary Domain DNS:
When you click ‘view’, a small box will appear. It will show your CURRENT nameservers, as well as the Preview DNS feature. If it is already activated, as it is in the case below, you can click on the link to see a preview of your site as you are building it. If it is NOT enabled, you can simply click ENABLE, which will allow this to happen. It does take a bit of time to be processed – not more than 24 hours.
When you click Preview My Site, you will see this:
Click on the link and a new window will open with the preview site. NOTE: if you’re building with Wordpress, as I was, you can still login to the backend by using the preview DNS URL and adding /wp-login.php at the end. Works great!
Very good question and really, it depends on several things. The most important thing is how skilled you or your employees are in the software and technology needed to build a professional website.
Remember: your website is often a potential customer’s first look at your company. With nearly all, if not all, of your competition sporting websites of their own, you have to be able to stand out from the crowd and present an online ’storefront’ that makes you visually appealing and worthy of a second look.