\n";
if(!empty($bgimage)) {
$background_styles = 'background-image: url(\'' . get_theme_mod('background_image', '') . '\');'
. ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';'
. ' background-position: top ' . get_theme_mod('background_position_x', 'left') . ';' . 'background-attachment: '. get_theme_mod('background_attachment', 'scroll');
echo "body { ".$background_styles."); } \n";
}
echo "";
}
}
// Add custom css to the editor
add_editor_style();
// Add default posts and comments RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// Standard Excerpt length
function gp_excerpt_length($length) {
return 60;
}
add_filter('excerpt_length', 'gp_excerpt_length');
// Special excerpt length per instance ie showcase column excerpts
function excerpt($num) {
$limit = $num+1;
$excerpt = explode(' ', get_the_excerpt(), $limit);
array_pop($excerpt);
$excerpt = implode(" ",$excerpt)."...";
echo $excerpt;
}
// change the excerpt ending
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
// Remove styles when the gallery shortcode is used.
function remove_gallery_css( $css ) {
return preg_replace( "##s", '', $css );
}
add_filter( 'gallery_style', 'remove_gallery_css' );
// Make this theme language capable
load_theme_textdomain( 'gp', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
// Stops WordPress from going to middle of full post view - very irrating. Thanks to http://digwp.com
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
add_filter('the_content_more_link', 'remove_more_jump_link');
/**
* Custom WordPress Search Results
* Default wordpress search will search everything so this keeps a cleaner results page with posts only
* Credit to www.bavotasan.com
**/
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');
// lets remove that irritating tags list after the comment form
function mytheme_init() {
add_filter('comment_form_defaults','mytheme_comments_form_defaults');
}
add_action('after_setup_theme','mytheme_init');
function mytheme_comments_form_defaults($default) {
unset($default['comment_notes_after']);
return $default;
}
/**
* Display navigation to next/previous pages when applicable
*/
function gp_content_nav( $nav_id ) {
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) : ?>
$word_limit)array_pop($words);return implode(' ', $words);}
// function for create a pages when we install a theme
function create_initial_pages() {
require( get_template_directory() . '/inc/page_content.php' );
$pages = array(
'Home' => "$Home",
'About us' => "$About_us",
'Services' => "$Services",
'Contact' => "$Contact",
);
foreach($pages as $key => $value) {
$id = get_page_by_title($key);
$page = array(
'post_type' => 'page',
'post_title' => $key,
'post_status' => 'publish',
'post_author' => 1,
'post_parent' => '',
'post_content'=> $value
);
if (!isset($id)) wp_insert_post($page);
};
}
// end function
// Create a Two new table wp_images and wp_gallery.
if ( ! function_exists( 'orizon_setup' ) ):
global $orizon_db_version;
$orizon_db_version = "1.0";
function orizon_setup() {
//update post per page Number install this theme.
global $wpdb;
global $orizon_db_version;
$table_name = $wpdb->prefix . "images";
$sql = "CREATE TABLE IF NOT EXISTS $table_name (
`image_id` int(55) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`image` varchar(255) NOT NULL,
`gallery_id` varchar(255) NOT NULL,
`date` varchar(255) NOT NULL,
PRIMARY KEY (`image_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1" ;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
$table = $wpdb->prefix . "gallery";
$qry= "CREATE TABLE IF NOT EXISTS $table (
`gallery_id` int(55) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`gallery_name` varchar(255) NOT NULL,
`date` date NOT NULL,
PRIMARY KEY (`gallery_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($qry);
add_option("jal_db_version", $orizon_db_version);
}
endif;
add_action( 'after_setup_theme', 'orizon_setup' );
// end function
// Pagination fucntion
function kriesi_pagination($pages = '', $range = 1)
{
$showitems = ($range * 1)+1;
$general_show_page = of_get_option('general_post_show');
global $paged;
global $paginate;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
$url= get_template_directory_uri();
if (of_get_option('color_scheme')=="0" or of_get_option('color_scheme')=="1") {
$leftpager= $url.'/css/red_css/images/left_pager.jpg';
$rightpager= $url.'/css/red_css/images/right_pager.jpg';
}
if (of_get_option('color_scheme')=="2") {
$leftpager= $url.'/css/blue_css/images/left_pager.jpg';
$rightpager= $url.'/css/blue_css/images/right_pager.jpg';
}
if($paged > 2 && $paged > $range+1 && $showitems < $pages) $paginate.= "";
if($paged > 1 ) $paginate.= "
";
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
$paginate.= ($paged == $i)? "
'.$tekst.'
'; $output .= 'Read more', '' ); ?>
%s ', get_comment_author_link() ); ?> - __( 'Reply ', 'Orizon' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
', '' ); ?> comment_approved == '0' ) : ?>