<?php
/**
* Theme functions file
*
* DO NOT MODIFY THIS FILE. Make a child theme instead: http://codex.wordpress.org/Child_Themes
*
* @package ClassiPress
* @author AppThemes
*/
global $cp_options;
// current version
$app_theme = 'ClassiPress';
$app_abbr = 'cp';
$app_version = '3.3';
$app_db_version = 1960;
$app_edition = 'Ultimate Edition';
// define rss feed urls
$app_rss_feed = 'http://feeds2.feedburner.com/appthemes';
$app_twitter_rss_feed = 'http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=appthemes';
$app_forum_rss_feed = 'http://forums.appthemes.com/external.php?type=RSS2';
// define the transients we use
$app_transients = array($app_abbr.'_cat_menu');
define( 'APP_TD', 'classipress' );
// Framework
require_once( dirname( __FILE__ ) . '/framework/load.php' );
// Payments
require_once( dirname( __FILE__ ) . '/includes/payments/load.php' );
// Options
require_once( dirname( __FILE__ ) . '/includes/theme-options.php' );
scb_register_table( 'app_pop_daily', $app_abbr . '_ad_pop_daily' );
scb_register_table( 'app_pop_total', $app_abbr . '_ad_pop_total' );
APP_Mail_From::init();
require_once( dirname( __FILE__ ) . '/framework/includes/stats.php' );
if ( is_admin() )
require_once( dirname( __FILE__ ) . '/framework/admin/importer.php' );
// Theme-specific files
require_once( dirname( __FILE__ ) . '/includes/theme-functions.php' );
// Start MultiPort Slider
if ( !function_exists('cp_ad_featured_thumbnail') ) :
function cp_ad_featured_thumbnail() {
global $post, $cp_options;
// go see if any images are associated with the ad
$image_id = cp_get_featured_image_id($post->ID);
// set the class based on if the hover preview option is set to "yes"
$prevclass = ( $cp_options->ad_image_preview ) ? 'preview' : 'nopreview';
if ( $image_id > 0 ) {
// get images for MultiPort
$adthumbarray = wp_get_attachment_image($image_id, 'featured-thumbnail');
// grab the large image for onhover preview
$adlargearray = wp_get_attachment_image_src($image_id, 'large');
$img_large_url_raw = $adlargearray[0];
// must be a v3.0.5+ created ad
if($adthumbarray) {
echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'" class="'.$prevclass.'" data-rel="'.$img_large_url_raw.'">'.$adthumbarray.'</a>';
// maybe a v3.0 legacy ad
} else {
$adthumblegarray = wp_get_attachment_image_src($image_id, 'thumbnail');
$img_thumbleg_url_raw = $adthumblegarray[0];
echo '<a href="'. get_permalink() .'" title="'. the_title_attribute('echo=0') .'" class="'.$prevclass.'" data-rel="'.$img_large_url_raw.'">'.$adthumblegarray.'</a>';
}
// no image so return the placeholder thumbnail
} else {
echo '<a href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '"><img class="attachment-featured-thumbnail" alt="" title="" src="' . appthemes_locate_template_uri('images/no-thumb.jpg') . '" /></a>';
}
}
endif;
// setup different image sizes
if ( function_exists( 'add_image_size' ) ) {
add_image_size('blog-thumbnail', 150, 150); // blog post thumbnail size, box crop mode
add_image_size('sidebar-thumbnail', 50, 50, true); // sidebar blog thumbnail size, box crop mode
add_image_size('featured-thumbnail', 140, 105, true); // featured slider thumbnail size, box crop mode
// create special sizes for the ads
add_image_size('ad-thumb', 75, 75, true);
add_image_size('ad-small', 100, 100, true);
add_image_size('ad-medium', 250, 250, true);
//add_image_size('ad-large', 500, 500);
}
// End MultiPort Slider
//Per Post Custom CSS
add_action('admin_menu', 'bb_custom_css_hooks');
add_action('save_post', 'bb_save_custom_css');
add_action('wp_head','bb_insert_custom_css');
function bb_custom_css_hooks() {
add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'post', 'normal', 'high');
add_meta_box('custom_css', 'Custom CSS', 'custom_css_input', 'page', 'normal', 'high');
}
function custom_css_input() {
global $post;
echo '<input type="hidden" name="custom_css_noncename" id="custom_css_noncename" value="'.wp_create_nonce('custom-css').'" />';
echo '<textarea name="custom_css" id="custom_css" rows="5" cols="30" style="width:100%;">'.get_post_meta($post->ID,'_custom_css',true).'</textarea>';
}
function bb_save_custom_css($post_id) {
if (!wp_verify_nonce($_POST['custom_css_noncename'], 'custom-css')) return $post_id;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;
$custom_css = $_POST['custom_css'];
update_post_meta($post_id, '_custom_css', $custom_css);
}
function bb_insert_custom_css() {
if (is_page() || is_single()) {
if (have_posts()) : while (have_posts()) : the_post();
echo '<style type="text/css">'.get_post_meta(get_the_ID(), '_custom_css', true).'</style>';
endwhile; endif;
rewind_posts();
}
}
date_default_timezone_set(America/Chicago);
There are currently 1 users browsing this thread. (0 members and 1 guests)