Wordpress
*@sub-package -> afia
*@since -> V 1.0.0
*/
?>
250)
$s = substr($d,0,244).'....';
else
$s = $d;
echo $s;
}
endif;
if ( ! function_exists( 'afia_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ...
* and a Continue reading link.
*
* @since afia 1.0.0
*
* @param string $more Default Read More excerpt link.
* @return string Filtered Read More excerpt link.
*/
function afia_excerpt_more( $more )
{
$link = sprintf( '%2$s',esc_url( get_permalink( get_the_ID() ) ),/* translators: %s: Name of current post */
sprintf( __( 'Continue reading %s ', 'afia' ), '' . get_the_title( get_the_ID() ) . '' ));
return ' … ' . $link;
}
add_filter( 'excerpt_more', 'afia_excerpt_more' );
endif;
/*
*Function to write the top bar content.
*/
if(! function_exists('afia_top_bar')):
function afia_top_bar()
{
if(!is_home()):
$home = ''.__('HOME','afia').' | ';
$single = ''. afia_title() .'';
$fin = $home.''.$single;
echo $fin;
else:
$fin = '';
endif;
}
//End of afia top bar.
endif;
/*
*Function to return the title of a page.
*/
if(! function_exists('afia_title')):
function afia_title()
{
if (is_archive())
{
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term)
{
return apply_filters('single_term_title', $term->name);
}
elseif (is_post_type_archive())
{
return apply_filters('the_title', get_queried_object()->labels->name);
}
elseif (is_day())
{
return sprintf(__('Daily Archives: %s', 'afia'), get_the_date());
}
elseif (is_month())
{
return sprintf(__('Monthly Archives: %s', 'afia'), get_the_date('F Y'));
}
elseif (is_year())
{
return sprintf(__('Yearly Archives: %s', 'afia'), get_the_date('Y'));
}
elseif (is_author())
{
$author = get_queried_object();
return sprintf(__('Author Archives: %s', 'afia'), $author->display_name);
}
else
{
return single_cat_title('', false);
}
}
elseif (is_search())
{
return sprintf(__('Search Results for %s', 'afia'), get_search_query());
}
elseif (is_404())
{
return __('Not Found', 'afia');
}
else
{
$c = get_the_category();
$cat_name = $c[0]->name;
$cat_id = get_cat_ID($cat_name);
$cat_link = get_category_link($cat_id);
$lk = ''.$cat_name.' | '.get_the_title();
return $lk;
}
}
endif;
/*
*function to edit details of user or login button if not logged in.
*
*@sub-package afia
*@since 1.0.0
*/
if(! function_exists('afia_logged_details')):
function afia_logged_details()
{
if(is_user_logged_in())
{
$current_user = wp_get_current_user();
$name = $current_user -> user_login;
$fin = ''.__('Logged in as: ','afia').''.$name.'';
$fin .= ' '.__('Logout','afia').'';
}
else if(! is_user_logged_in())
{
$fin = ''.__('Login','afia').''.__(' or', 'afia').' '.__('Register','afia').'';
}
echo ''.$fin.'';
}
endif;
/*
*function to echo the footer text.
*/
if(!function_exists('afia_echo_footer')):
function afia_echo_footer()
{
$txt = ' WordPress: © 2015 ';
$date = date('Y');
if($date > 2015):
$txt .= '- '.$date;
endif;
$t = __('Theme powered by:','afia'). $txt . ''. get_bloginfo( 'title' ) .'';
return $t;
}
endif;
function afia_set_up()
{
add_theme_support( 'post-thumbnails' );
/**
*Add support for background info.
*/
$background_args = array('default-color' => '#f2f2f2','default-repeat' => 'fixed','default-image' => esc_url(get_template_directory_uri() . '/assets/img/pat.jpg'),);
add_theme_support( 'custom-background', $background_args );
/**
*Register menus.
*/
register_nav_menus( array('primary' => 'Primary Navigation'));
/**
*Add support for header image.
*/
$defaults = array(
'default-image' => '',
'width' => 850,
'height' => 371,
'flex-height' => false,
'flex-width' => false,
'uploads' => true,
'random-default' => false,
'header-text' => false,
);
add_theme_support( 'custom-header', $defaults );
/**
*Add support for feed.
*/
add_theme_support( 'automatic-feed-links' );
/**
*Add support for title to avoid hard coding.
*/
add_theme_support( 'title-tag' );
// editor style
add_editor_style('/assets/css/editor-style.css');
// Content width
global $content_width;
if (!isset($content_width)) { $content_width = 657; }
}
add_action('after_setup_theme', 'afia_set_up');
function afia_setup_cus($wp_customize )
{
//Logo settings
$wp_customize->add_panel( 'afia_logo_settings', array(
'priority' => 200,
'capability' => 'edit_theme_options',
'title' => __( 'Logo Settings', 'afia' ),
'description' => __('customize Logo', 'afia'),
));
$wp_customize->add_section( 'afia_logo_upload_section', array(
'title' => __( 'Upload a Logo', 'afia' ),
'priority' => 2,
'capability' => 'edit_theme_options',
'panel' => 'afia_logo_settings',
));
$wp_customize->add_setting( 'afia_upload_logo', array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,'logo',array(
'label' => __( 'Upload a logo.', 'afia' ),
'section' => 'afia_logo_upload_section',
'settings' => 'afia_upload_logo',
)
));
//Text settings
$wp_customize->add_panel( 'afia_text_settings', array(
'priority' => 102,
'capability' => 'edit_theme_options',
'title' => __( 'Text Color and Font Settings', 'afia' ),
'description' => __('customize your text', 'afia'),
));
$wp_customize->add_section('afia_text_colors',array(
'title' => __( 'Colors', 'afia' ),
'priority' => 1,
'capability' => 'edit_theme_options',
'panel' => 'afia_text_settings',
));
$wp_customize->add_section('afia_text_fonts',array(
'title' => __( 'Fonts', 'afia' ),
'priority' => 2,
'capability' => 'edit_theme_options',
'panel' => 'afia_text_settings',
));
$wp_customize->add_setting( 'afia_heading_color',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize, 'afia_heading_color',array(
'section' => 'afia_text_colors',
'label' => __( 'Heading Text Color','afia' ),
'description' => __( 'Set the font color of the post, comment and widget headings.','afia' ),
) ));
$wp_customize->add_setting( 'afia_heading_font',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'afia_heading_font', array(
'type' => 'text',
'priority' => 1,
'section' => 'afia_text_fonts',
'label' => __('Heading font.', 'afia'),
'description' => __( 'Set the font name of all post, comment and widget headings.','afia' ),
));
//Set for links
//unvisited links.
$wp_customize->add_setting( 'afia_link_color',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize, 'afia_link_color',array(
'section' => 'afia_text_colors',
'label' => __( 'Unvisted Link Text Color','afia' ),
'description' => __( 'Set the color of all unvisited links.','afia' ),
) ));
$wp_customize->add_setting( 'afia_link_font',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'afia_link_font', array(
'type' => 'text',
'priority' => 1,
'section' => 'afia_text_fonts',
'label' => __('Unvisited Link font.', 'afia'),
'description' => __( 'Set the font name of all links in your page','afia' ),
));
//Hovered links
$wp_customize->add_setting( 'afia_hover_color',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize, 'afia_hover_color',array(
'section' => 'afia_text_colors',
'label' => __( 'Hovered Link Text Color','afia' ),
'description' => __( 'Set the color of all hovered links.','afia' ),
) ));
$wp_customize->add_setting( 'afia_hover_font',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'afia_hover_font', array(
'type' => 'text',
'priority' => 1,
'section' => 'afia_text_fonts',
'label' => __('Hovered Link font.', 'afia'),
'description' => __( 'Set the font name of hovered links in your page','afia' ),
));
//Main body content.
$wp_customize->add_setting( 'afia_main_color',
array(
'default' => '#000000',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize, 'afia_main_color',array(
'section' => 'afia_text_colors',
'label' => __( 'Main content Text Color','afia' ),
'description' => __( 'Set the color for main post content.','afia' ),
) ));
$wp_customize->add_setting( 'afia_main_font',
array(
'default' => 'Georgia',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'afia_main_font', array(
'type' => 'text',
'priority' => 1,
'section' => 'afia_text_fonts',
'label' => __('Main Content font.', 'afia'),
'description' => __( 'Set the font name of Main content, ie post content.','afia' ),
));
$wp_customize->add_setting( 'afia_main_size',
array(
'default' => '16px',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'afia_main_size', array(
'type' => 'text',
'priority' => 1,
'section' => 'afia_text_fonts',
'label' => __('Main Content font size.', 'afia'),
'description' => __( 'Set the font size name of Main content, ie post content.','afia' ),
));
//Main background
$wp_customize->add_setting( 'afia_main_back',
array(
'default' => '#ffffff',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control(new WP_Customize_Color_Control( $wp_customize, 'afia_main_back',array(
'section' => 'colors',
'label' => __( 'Main content Background Color','afia' ),
'description' => __( 'Set the Background color for main post content.','afia' ),
) ));
}
add_action( 'customize_register', 'afia_setup_cus' );
/**
* Register our sidebars and widgetized areas.
*
*/
function afia_widgets_init() {
register_sidebar( array(
'name' => __('right sidebar','afia'),
'id' => 'sidebar-primary',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'afia_widgets_init' );
function afia_customze_css()
{
?>
ID ) ? rand() : $post->ID );
$password_form = '';
return $password_form;
}
apply_filters( 'the_password_form', 'afia_password_form' );
?>