__( 'Primary navigation menu', 'affyb' ),
'footer-nav' => __( 'Footer navigation menu', 'affyb' ), // This menu appears in the footer
)
);
function affyb_widgets_init() {
register_sidebar( array( // Register Main Sidebar and add class "widget" to the widget
'name' => __( 'Main Sidebar', 'affyb' ),
'id' => 'sidebar',
'description' => __( 'Add widgets here to view them in the Main Sidebar.', 'affyb' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array( // Register Footer Sidebar and add class "widget-footer" to the widget
'name' => __( 'Footer Sidebar', 'affyb' ),
'id' => 'sidebar-footer',
'description' => __( 'Add widgets here to view them in the Footer Sidebar.', 'affyb' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'affyb_widgets_init' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'title-tag' );
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
'caption',
) );
add_theme_support( 'custom-logo', array( // Add theme support for Custom Logo.
'height' => 80,
'width' => 80,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
add_theme_support( 'custom-header', array ( // Add theme support for Custom Header image.
'height' => 250,
'width' => 1200,
'flex-height' => true,
'flex-width' => true,
'default-text-color' => '#23282d',
'uploads' => true
) );
add_theme_support( 'custom-background', array ( // Add theme support for background image.
'default-color' => '#002530',
'default-repeat' => 'repeat',
'default-position-x' => 'center',
'default-position-y' => 'center',
'default-size' => 'auto',
'default-attachment' => 'fixed',
) );
add_editor_style( get_template_directory_uri() . '/assets/css/other/editor-style.css' ); // Add custom editor style to wordpress editor
if ( ! isset( $content_width ) ) {
$content_width = 600;
}
}
add_action('after_setup_theme', 'affyb_setup');
function affyb_add_styles() {
wp_enqueue_style( 'affyb', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'affyb_add_styles' );
function affyb_adding_scripts() {
wp_register_script('affyb_js_translate', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'),null, true);
wp_register_script('affyb_js_validate', get_template_directory_uri() . '/assets/js/vendor/jquery.validate.js', array('jquery'),null, true);
wp_enqueue_script('affyb_js_translate');
$translation_array = array(
'placeholderval1' => __( 'What you are looking for', 'affyb' ),
'placeholderval2' => __( 'You did not write anything, try again', 'affyb' ),
'template_directory_uri' => get_template_directory_uri(),
);
wp_localize_script( 'affyb_js_translate', 'object_name', $translation_array );
if (is_singular()) {
wp_enqueue_script('affyb_js_validate');
}
}
add_action( 'wp_enqueue_scripts', 'affyb_adding_scripts' );
function affyb_adding_login_scripts_style() {
wp_enqueue_style( 'custom-login', get_template_directory_uri() . '/assets/css/other/style-login.css' );
wp_register_script('affyb_login_js_translate', get_template_directory_uri() . '/assets/js/style-login.js', array('jquery'),null, false);
wp_enqueue_script('affyb_login_js_translate');
$translation_array = array(
'backto' => __( 'Return to', 'affyb' ) . ' ' . get_bloginfo( 'name' ),
);
wp_localize_script( 'affyb_login_js_translate', 'object_name', $translation_array );
}
add_action( 'login_footer', 'affyb_adding_login_scripts_style' );
function affyb_custom_excerpt_length($length) { // custom excerpt length
global $excerpt_lenght;
if ( get_option( 'excerpt_lenght' ) ) {
$excerpt_lenght = get_option('excerpt_lenght');
}
else {
$excerpt_lenght = 80;
}
return $excerpt_lenght;
}
add_filter('excerpt_length', 'affyb_custom_excerpt_length', 999);
function affyb_excerpt_more($more) {
global $post;
return '';
}
add_filter('excerpt_more', 'affyb_excerpt_more');
function affyb_add_comment_author_to_reply_link($link, $args, $comment) {
$comment = get_comment( $comment );
if ( empty($comment->comment_author) ) {
if (!empty($comment->user_id)){
$user=get_userdata($comment->user_id);
$author=$user->user_login;
} else {
$author = __('Anonymous', 'affyb');
}
} else {
$author = $comment->comment_author;
}
if(strpos($author, ' ')) {
$author = substr($author, 0, strpos($author, ' '));
}
$reply_link_text = $args['reply_text'];
$link = str_replace($reply_link_text, '' . __('Respond to', 'affyb') . ' ' . ' ' . $author . '', $link);
return $link;
}
add_filter('comment_reply_link', 'affyb_add_comment_author_to_reply_link', 10, 3);
function affyb_comment_placeholders($fields) {
$fields['author'] = str_replace(
'' . __('your comment', 'affyb') . ' * ';
return $arg;
}
add_filter('comment_form_defaults', 'affyb_modify_comment_form_text_area');
function affyb_textarea_placeholder( $fields ) {
$fields['comment_field'] = str_replace(
'