Load wordpress posts by category Slug from the URL

By | Wordpress | No Comments

Here is a quick wordpress development tip to help you load posts into the wordpress loop based off the category slug in the URL. This assumes you are using the postname permalink structure for your url, e.g. mysite.com/category/testcategry.

In your functions file add this function:
[php] function getLastPathSegment($url) {
$path = parse_url($url, PHP_URL_PATH);
$pathTrimmed = trim($path, ‘/’);
$pathTokens = explode(‘/’, $pathTrimmed);
if (substr($path, -1) !== ‘/’) {
array_pop($pathTokens);
}
return end($pathTokens);
}
[/php]

This function will process the slug we will pass to it from the template file. In your template file:

[php] $slug = getLastPathSegment($_SERVER[‘REQUEST_URI’]); // Get the last slug item
$category = get_category_by_slug($slug); // Load the category
query_posts(‘showposts=-1&post_status=publish&cat=’.$category —>cat_ID); // Load the posts

// WordPress Loop as normal
[/php]

Pactimo.com WordPress Launch

By | Wordpress | No Comments

Pactimo.com WordPress Developer

Contracted by Pactimo, a Colorado based bicycle apparel company, to develop a new custom WordPress theme and build out a new WordPress content management system; the site features numerous custom content types, a custom dynamic product catalog feeding from bigcommerce with a great design on top of it all.

Check out the site.

As always I am available for wordpress content management development and theme development – contact me!

Green/Organic Businesses and Non-profits: Discounted Web Design & Development Service

By | Wordpress | No Comments

Currently I am offering discounted web design and development services for a number of types of companies – green businesses, Eco-friendly companies, organic business and non-profits. But why you may ask? Simple. I see that the world can benefit from people and business that are concerned with the environment, health and other people and wish to be apart of promoting those companies.

Green Businesses

If you operate your business with as minimal footprint as possible, use recycled materials or recycle materials, use solar power or any other low impact environmental methods.

Organic Businesses

If you sell or market any health foods, organic foods, gluten free foods or personal products.

Non-Profits

If you are a non-profit and have a cause bettering this world and humanity.

Contact me to discuss designing or developing a website for your business.

PHP Includes for Non-Developers

By | Wordpress | 6 Comments

I usually will not write tutorials as there are many great ones available on any given topic; but this one I have not often seen, and would have loved to have known about it along time ago.

Any HTML/CSS web designer who doesn’t know PHP can certainly make good use of this PHP include statement. PHP includes are very useful for making global changes on smaller HTML/CSS websites, just as CSS is a tool to easily make global changes to styles and layouts.

code

Read More