This is the final part in the Artisteer Investica series, all we are doing here is a tidy up and some more functionality, we are also creating a couple of templates with a list and two column layout.
The download for this part is the full theme we are not separating the files in the download, you are free to use the theme, if you use the theme unmodified and “as is” please leave the Digital Raindrops and Artisteer links in the footer.
Final Changes
To enable us to select the posts we want for the Home Page two columns we will add a category and a post filter, we will not know the category id so we will add a function that creates a category called ‘Home’, to do this we we will edit the /library/inv-functions.php and add a new function.
While we are in the inv-functions.php we will enable the administrator to change the background, and move some calls into a function, this function will run after the theme has loaded, and after functions.php.
There are a few options we do not want the administrator to change, we will just remark these in /library/options.php, these are so the thumbnail sizes are set and cannot be modified.
To top it off two page templates, these will both look for a category with the same name as the page, like category news and page title News, these will return all posts in the category with no pagination.
The first template page ‘One Category List’ has no sidebar and lists the title, thumbnail and excerpt, the second has a sidebar and will use the two column layout from the home page, these might work well for real estate, music, software and magazine sites.
In this post we will be showing some changes, if you want to merge them with your own files, copy the code from the downloaded theme, as we have moved some parts of code.
Download the Final Theme: [download id="63"]
inv-functions.php
In /library/inv-functions.php, we have added a new function at the start of the file and moved some of the previous code inside the function, the new call add_custom_background(); is run after theme setup is to enable the background image or color to be changed from Admin > Appearance > Background
add_action( 'after_setup_theme', 'investica_setup' );
if ( ! function_exists( 'investica_setup' ) ):
function investica_setup() {
/*
We want to crop the featured images for our list thumbnails and home page displays
These are WordPress standard functions
*/
set_post_thumbnail_size(150,102);
add_image_size( 'homepage-thumbnail', 250, 170, true ); //Cropped
/* Allow Administrator to change Background */
add_custom_background();
}
endif;
The second function is to set the home category as default, this function might be of use on a theme where particular categories must be created and used.
/*Insert the home category for the home posts*/
function inv_insert_category($taxonomy,$catName){
if (!$taxonomy || !$catName) exit;
/* if we have a category name then insert the category */
if(!term_exists($catName, $taxonomy) && $catName){
$cat_defaults = array(
'name' => $catName,
'description' => $catName);
$temp = wp_insert_term($catName, $taxonomy, $cat_defaults);
}
}
inv_insert_category('category','Home');
home.php
In our home.php file we want to filter only on the new Home Category this means we can strictly control what is seen on our home landing page, if the theme was adapted for Real Estate the the best properties could be selected.
The line query_posts( array ( ‘category_name’ => ‘Home’, ‘posts_per_page’ => 4 ) ); will only show up to four posts, for all posts change to -1 or set the number to any multiple of two.
<?php get_header(); ?>
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content">
<?php get_sidebar('top'); ?>
<?php
//Only 2 posts from the home category
query_posts( array ( 'category_name' => 'Home', 'posts_per_page' => 4 ) );
if(have_posts()) {
/* Display navigation to next/previous pages when applicable */
if ( theme_get_option('theme_' . (theme_is_home() ? 'home_' : '') . 'top_posts_navigation' ) ) {
theme_page_navigation();
}
/* Start the Counter */
$counter=0;
/* Start the Loop */
while (have_posts()) {
the_post();
get_template_part('content', 'home');
}
//Increment our counter and clear the float after column right
$counter++;
if (!$counter % 2){
?>
<div class="cleared"></div>
<?php
}
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_bottom_posts_navigation')) {
theme_page_navigation();
}
// Reset Query
wp_reset_query();
} else {
?>
<p>
<h6 style="font-size:20px; color:#888888; margin-left: 10px">Add Posts to the Home Category, Admin > Posts</h6>
</p>
<?php
//theme_404_content();
}
?>
<?php get_sidebar('bottom'); ?>
<div class="cleared"></div>
</div>
<div class="art-layout-cell art-sidebar1">
<?php get_sidebar('default'); ?>
<div class="cleared"></div>
</div>
</div>
</div>
<div class="cleared"></div>
<?php get_footer(); ?>
There is also a call to reset the query, if no posts are found there will not be a 404 page but a message.
options.php
We want to stop some of the theme options from being changed, to disable these we remark the blocks of options we want to disable.
To remark these we start with /* and end with */ this can be over many lines
/* Hide from Administrator
array(
'name' => __('Featured Image', THEME_NS),
'type' => 'heading'
),
array(
'id' => 'theme_metadata_use_featured_image_as_thumbnail',
'name' => __('Use featured image as thumbnail', THEME_NS),
'desc' => __('Yes', THEME_NS),
'type' => 'checkbox'
),
array(
'id' => 'theme_metadata_thumbnail_auto',
'name' => __('Use auto thumbnails', THEME_NS),
'desc' => __('Generate post thumbnails automatically (use the first image from the post gallery)', THEME_NS),
'type' => 'checkbox'
),
array(
'id' => 'theme_metadata_thumbnail_width',
'name' => __('Thumbnail width', THEME_NS),
'desc' => __('(px)', THEME_NS),
'type' => 'numeric'
),
array(
'id' => 'theme_metadata_thumbnail_height',
'name' => __('Thumbnail height', THEME_NS),
'desc' => __('(px)', THEME_NS),
'type' => 'numeric'
),
*/
array(
'name' => __('Excerpt', THEME_NS),
'type' => 'heading'
),
/* Hide from Administrator
array(
'id' => 'theme_metadata_excerpt_auto',
'name' => __('Use auto excerpts', THEME_NS),
'desc' => __('Generate post excerpts automatically (When neither more-tag nor post excerpt is used)', THEME_NS),
'type' => 'checkbox'
),
*/
page-category-list.php
In the download there is a new Template Page file called page category list, to use this template create a page with a name the same as a category, on our local install we have just called the category and page ‘posts’, to use the template we apply it from Pages > Pages > Edit where we also turn off the title.
We can see from the image below that the page text shows before the lists of posts and there is no sidebar, this page uses the ‘content’ ‘archive’ template part in the page code.
Switching the template page to the One Category Columns we use the template part ‘content’ ‘home’ we will leave you to look at the code, you will see that we have removed the comments and the -1 means all posts in that category will be shown.
Visit the test site to see these changes in action and please do register and use the supporters website for feedback!
That is the end of this series, we hope that you will find a nugget of information that will help you along the way, a final thought is that Artisteer seem to have bounced back with this version and we hope they will continue that way.
Notices
We do require your feedback to improve our themes and tutorials, please leave your comments good or bad.
Code disclaimer information
If this document contains programming examples, www.DigitalRaindrops.net grants you a nonexclusive copyright license to use all programming code from which you can generate similar functions tailored to your own specific needs.
All sample code is provided by http://DigitalRaindrops.net for learning illustrative purposes only.
These examples have not been thoroughly tested under all conditions. www.DigitalRaindrops.net, therefore, cannot guarantee or imply reliability, serviceability, or function of these examples.
All programs contained herein are provided to you “AS IS” without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.
Membership
Registration is now open: New Member Registration
Membership is now open: Existing Member Login
Visit the: Forum and Feedback
This website is a tool to support and promote WordPress and Artisteer theme development, please support, share and give credit for any benefits you gain from the tutorials on this website.






We have just updated the final download, as we were not happy with the two column posts.
They now have a fixed height and the button code has been updated to display after the post and before the closing div of the two-column
Changes in:
functions.php
content-home.php
inv-style.css
David