As you can see on the frontpage, I am using Autofocus+ Pro for this blog.
This fantastic theme has just been updated to V 2.0. This is not a minor update, because AF II (Pro) does not rely on the Thematic-framework anymore. And it comes with a sample child-theme, which I highly recommend to use!!
Why? Because a the genious concept of child-themes lets you pimp, hack, enhance your theme, without losing all your customizations in case of an update. Also there are only a few files you have to take care of. Well, actually it can become many — depending on your creativity…
All you have to do is upload the child-theme to a separate folder along with the main theme of Autofocus and activate it — yes, the child, not Big Mama!!
Anything you want to change goes into that folder: functions, css, templates… whatever.
Once the child-theme is activated, mother will always look what her child has to say about it before she feeds anything to the WordPress-loop.
When I first used AF Pro, I immediately stumbled into a problem. Fear not, it can be solved easily. The old hack for former versions, that I explained a year ago, does not work anymore, so here is the new way to do it.
The theme has a couple of options. One of them is that you can define a category and a template for a blog page. But: You can only pick just one category in the theme-options which is used for this special page. If you want to use the blog-template for another page which only holds articles with a different category — in my case the KnowHow-page — you are stuck.
So what to do?
You could ask the author of the theme for help. Pro or not Pro-version (paid or not paid), he will point you to — yes, right — google, in order to find solutions for creating your own templates. You can do that of course — or read on…
Yeah ‚theres tons of explanations for that.Try googling it.
I solved the problem myself the following way.
I copied the file blog-page.php from the theme. Best is to download it with a ftp-client (I use the client integrated in Totalcommander) to a folder on your HD. Then copy it twice (or more, depends on how many sub-sections you want to have blog-wise!) and give the files meaningful names. For example, if the blog-page you are going to use it for, is called “Design”, name it design-template.php.
Edit the renamed file with an editor of your choice (I recommend notepad++) and change the name of the template in line 3 to Design Template (or whatever you want it to be).
Example:
/**
* Template Name: AF+ Blog Template - pimped by mic
*
* A custom page template without sidebar.
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu on the edit page screen.
*
* @package WordPress
* @subpackage AutoFocus_Two
* @since AutoFocus 2.0
*/
get_header(); ?>
!! If you miss this step, the template will never appear in the dropdown-menu for templates on the right when you create a new page or change the properties of an existing one.
It is a merely internal thing though. This has nothing to do with the name of the blog-page or –category and will not appear anywhere on the public part of your blog.
Next we look for a line that looks like this:
$af_blog_catid = of_get_option( $shortname . '_blog_cat' );
and change it to (for example):
$af_blog_catid = 19;
!! whereas 19 is the ID of the category I use for the given page (KnowHow).
For you the number may and will differ! This means that you have to create this category first — or, if it already exists, find out its ID.
You can see the ID (the number) in the bottom left corner of your browser, when you hover the category in the category-menu (BTW: This is useful for many purposes!).
So in my case the complete block (here with comments for easier understanding & documentaion) looks like this:
// Start the loop for the Blog Category
global $paged, $more, $shortname;
$more = 0;
/* the original line with parsing cat_id from theme-options - hack below */
/* $af_blog_catid = of_get_option( $shortname . '_blog_cat' ); */
$af_blog_catid = 1; /*this is the "General" category on my blog*/
Wipe the sweat from your forehead, get a drink. Your’re almost done
Upload the new template(s) to the child-theme-directory on your webspace.
Then you create the new page called Design (or whatever) and attach the appropriate template (e.g. design-template) to it by using Edit/Quickedit from the property-section of “Pages”.
On the page you’ve now created and married with the hacked template from above, only articles with the defined category-ID (19 in this example) will appear.
Nifty
And in case you want to create another page for another category of articles simply repeat the same steps (download, copy, rename, find out the category-ID, edit, upload, assign template to new page …) and you’re done.
Oh, and this should work as well for the free version of the autofocus+-theme. I guess. Did not check though. But I can’t see why it shouldn’t
If have any questions, feel free to ask.
One Trackback
By Enhance WP-theme Autofocus+ | GrainWorks 31 Jul ’11 at 14:14