%4$s ', 'sp_magazine' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
}
function business_world_posted_on_single() {
printf( __( '%4$s %7$s ', 'sp_magazine' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'sp_magazine' ), get_the_author() ) ),
get_the_author()
);
}
function business_world_entry_meta() {
$categories_list = get_the_category_list(', ' );
echo '';
if ( $categories_list ) {
echo ' ' . $categories_list . ' ';
}
$tag_list = get_the_tag_list( '', ' , ' );
if ( $tag_list ) {
echo ' ' . $tag_list . ' ';
}
echo '
';
}
function business_world_post_nav() {
global $post;
$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous )
return;
?>
← %title', 'Previous post link' ); ?>
→', 'Next post link' ); ?>
'Primary Widget Area',
'id' => 'sidebar-1',
'description' => 'The primary widget area',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => ' ',
)
);
// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
register_sidebar(array(
'name' => 'Secondary Widget Area',
'id' => 'sidebar-2',
'description' => 'The secondary widget area',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(array(
'name' => 'Footer Widget Area',
'id' => 'footer-widget-area',
'description' => 'The footer widget area',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
}
add_action('widgets_init', 'business_world_widgets_init');
/*************************************/
/* BODY CLASS BAD CLASS */
/*************************************/
add_filter('body_class', 'business_world_multisite_body_classes');
function business_world_multisite_body_classes($classes){
foreach($classes as $key=>$class)
{
if($class=='blog')
$classes[$key]='blog_body';
}
return $classes;
}
/*************************************/
/* CALL FUNCTIONS AFTER THEME SETUP */
/*************************************/
function business_world_setup_elements()
{
// add custom header in admin menu
add_theme_support( 'custom-header', array(
'default-text-color' => '220e10',
'default-image' => '',
'header-text' => false,
) );
// add custom background in admin menu
$expert_defaults = array(
'default-color' => 'FEFEFE',
'default-image' => '',
'admin-head-callback' => '',
'admin-preview-callback' => ''
);
add_theme_support( 'custom-background', $expert_defaults );
// For Post thumbnail
add_theme_support('post-thumbnails', array('post'));
set_post_thumbnail_size(150, 150);
add_image_size( 'business-width', 250, 230, true );
// requerid features
add_theme_support('automatic-feed-links');
/// include language
load_theme_textdomain('sp_magazine', get_template_directory_uri() . '/languages' );
// registr menu,
register_nav_menu('primary-menu', 'Primary Menu');
// for editor styles
add_editor_style();
}
add_action('after_setup_theme', 'business_world_setup_elements');
/*************************************/
/* MENU CUSTOM CLASSES */
/*************************************/
function business_world_add_first_and_last($output) {
$output = preg_replace('/class="menu-item/', 'class="first menu-item', $output, 1);
$output = substr_replace($output, 'class="last menu-item', strripos($output, 'class="menu-item'), strlen('class="menu-item'));
return $output;
}
add_filter('wp_nav_menu', 'business_world_add_first_and_last');
function business_world_add_first_and_last_page_list($output) {
$output = preg_replace('/class="page_item/', 'class="first page_item', $output, 1);
if(strripos($output, 'class="page_item'))
$output = substr_replace($output, 'class="last page_item', strripos($output, 'class="page_item'), strlen('class="page_item'));
return $output;
}
add_filter('wp_list_pages', 'business_world_add_first_and_last_page_list',10);
/**************************************/
/*FUNCTION FOR FRONT END PRINT CONTENT*/
/**************************************/
function business_world_excerpt_max_charlength($charlength,$content=false) {
if($content){
$excerpt=$content;
}
else{
$excerpt = get_the_excerpt();
}
$charlength++;
if ( mb_strlen( $excerpt ) > $charlength ) {
$subex = mb_substr( $excerpt, 0, $charlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo mb_substr( $subex, 0, $excut ).'...';
} else {
echo $subex.'...';
}
}
else {
echo $excerpt;
}
}
function business_world_excerpt_more( $more ) {
return '...';
}
add_filter('excerpt_more', 'business_world_excerpt_more');
/**************************************/
/* GET POST FRSTIMAGE FOR WHUMBNAIL */
/**************************************/
function business_world_catch_that_image()
{
global $post, $posts;
$first_img = '';
$output = preg_match_all('//i', $post->post_content, $matches);
if(isset($matches [1] [0])){
$first_img = $matches [1] [0];
}
if (empty($first_img)) {
$first_img = get_template_directory_uri() . "/images/default.jpg";
}
return $first_img;
}
function business_world_first_image($width, $height,$url_or_img=0)
{
$thumb = business_world_catch_that_image();
if ($thumb) {
$str = " ';
return $str;
}
}
function business_world_empty_thumb()
{
$thumb = get_post_custom_values("Image");
return !empty($thumb);
}
/**************************************/
/* GENERETE IMAGE FOR POST THUMBNAIL */
/**************************************/
function business_world_display_thumbnail($width, $height)
{
if (function_exists('has_post_thumbnail') && has_post_thumbnail()) the_post_thumbnail(array($width, $height));
elseif (!business_world_empty_thumb()) {
return business_world_first_image($width, $height);
} else {
return business_world_post_thumbnail($width, $height);
}
}
function business_world_thumbnail($width, $height)
{
if (function_exists('has_post_thumbnail') && has_post_thumbnail())
the_post_thumbnail(array($width, $height));
elseif (business_world_empty_thumb()) {
return business_world_post_thumbnail($width, $height);
}
else
return '';
}
/**************************************/
/* REMOVE MORE IN POSTS AND PAGES */
/**************************************/
function business_world_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', 'business_world_remove_more_jump_link');
/**************************************/
/* REMOVE MORE IN POSTS AND PAGES */
/**************************************/
add_action( 'pre_get_posts', 'business_world_main_queries' );
function business_world_main_queries($query){
if(is_home() && is_front_page() && $query->is_main_query()){
global $business_world_home_page;
foreach ($business_world_home_page->options_homepage as $value)
{
if(isset($value['id']))
{
if (get_theme_mod( $value['id'] ) === FALSE)
{
$$value['var_name'] = $value['std'];
}
else {
$$value['var_name'] = get_theme_mod( $value['id'] );
}
}
}
$cat_query="";
$cat_checked="";
$n_of_home_post=get_option( 'posts_per_page', 6 );
$cat_query=substr($content_post_categories, 0, -1);
$query->set( 'posts_per_page', $n_of_home_post );
$query->set( 'paged',get_query_var('paged') );
$query->set( 'cat', $cat_query );
$query->set( 'order', 'DESC' );
}
}
/*******************************/
/*PAGE AND POST LEAYUT METADATE*/
/*******************************/
function business_world_update_page_layout_meta_settings()
{
/*update page layout*/
global $post,$business_world_layout_page;
if(isset($post))
$business_world_meta_date = get_post_meta($post->ID, 'business_world_meta_date', TRUE);
if(!isset($business_world_meta_date['content_width']))
$business_world_meta_date['content_width'] = $business_world_layout_page->options_themeoptions['content_area']['std'];
if(!isset($business_world_meta_date['main_col_width']))
$business_world_meta_date['main_col_width'] = $business_world_layout_page->options_themeoptions['main_column']['std'];
if(!isset($business_world_meta_date['layout']))
$business_world_meta_date['layout'] = $business_world_layout_page->options_themeoptions['default_layout']['std'];
if(!isset($business_world_meta_date['pr_widget_area_width']))
$business_world_meta_date['pr_widget_area_width'] = $business_world_layout_page->options_themeoptions['pwa_width']['std'];
if (isset($business_world_meta_date['fullwidthpage']) && $business_world_meta_date['fullwidthpage']=='on') {
$them_content_are_width='100%';
?>