Week Eleven (MGDP2060)

From Wiki @ Karl Jones dot com
Revision as of 14:07, 6 November 2016 by Karl Jones (Talk | contribs)

Jump to: navigation, search

This article lists topics for week eleven of Web Design and Development III (MGDP2060).

See also Week Ten and Week Twelve.


Making a Smarter Product Page

Individual product pages display unnecessary information, like author name.

Individual product pages are displayed by the single.php template.

Highlighting Products on Sale

The "Better Home Page" example is meant for smaller websites, where the number of items is small enough to display well on the home page.

Larger websites, with a large number of items, may need some other approach.

For example a "Products on sale" or "Featured" category.

Each product belongs to both "Sofas" and "Featured" categories.

Or perhaps "Featured1", "Featured2", and "Featured3", corresponding to three columns.

Cleaning Out the Templates (536)

Individual product pages are displayed by the single.php template.

The single.php template gets help from another template, depending on type of content it's displaying.

Ordinary posts use the content-single.php template to do the work.

When displaying a post that uses a custom post type, WordPress automatically looks for a template file in this form:

single-type.php

Where type is the registered name of the custom post type, in this case "product":

single-product.php

Use this template to display content for individual products.

Creating single-product.php (537)

Make a copy of single.php. Name the copy single-product.php.

Remove the navigation links.

Modify the get_template_part function:

<?php get_template_part( 'content', 'single-product' ); ?>

Creating content-single-product.php

..

Adding a Category Description

..

Custom Fields (539)

See WordPress Custom Field.

Classifying Your Posts with Custom Taxonomies (542)

A taxonomy is a system of classification.

WordPress provides two taxonomies: Categories and Tags.

You add custom taxonomies of your own: like Categories or Posts, but using terminology customized for a specific purpose.

See WordPress Custom Taxonomy.

Exercises

See Week Eleven Exercises (MGDP2060).