How to add a “share this” button to Artisteer 2.5 Theme

In Themes by MyrddinLeave a Comment

The latest Artisteer 2.5 included a big change in the file structure. Everything seems a bit more complicated now, but it is still easy to apply customization changes. While I am not the biggest fan of all these new social networking sites this may be different for visitors to this site and I decided to add a “share this” button to posts and pages.

Metadataheader

One change I’d also like to apply is to enable author and date on wordpress pages which Artisteer hides by default. Lets have a look at the file “post_metadataheader.php”:

<div>
   <?php echo $postheadericons; ?>
</div>

As you can see they call a function for the header meta data. So lets have a look at the “functions.php”:

Date and Author

Search for “function art_get_post_metadata($name)”

for($i = 0; $i < count($list_array); $i++){
$icon = $list_array[$i];
switch($icon){
    case 'date':
        if(is_page()) break;
        $result[] = art_get_post_icon($icon) . get_the_date();
    break;
    case 'author':
         if(is_page()) break;
         ob_start();
         the_author_posts_link();
         $result[] = art_get_post_icon($icon) . __('Author', THEME_NS) .' '. ob_get_clean();
    break;

Delete or comment out the bold “if(is page()) break;” lines to enable date and author on pages.

Add the Button

Now we can easily add the following code to the file “post_metadataheader.php”.

<div>
<?php echo $postheadericons; ?><?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') AND (is_singular()) ) {
echo " | "; ADDTOANY_SHARE_SAVE_KIT();
} ?>
</div>

This will only show the “share this button to single posts or pages – “is_singular()” – and not on list pages like archives, search, categories and tags.

Hope that helps!

Leave a Comment