tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support('post-thumbnails' ); // Add featured image sizes add_image_size( 'featured-large', 640, 294, true ); // width, height, crop add_image_size( 'featured-small', 320, 147, true ); // Add other useful image sizes for use through Add Media modal add_image_size( 'medium-width', 480 ); add_image_size( 'medium-height', 9999, 480 ); add_image_size( 'medium-something', 280,280,true ); // Register the three useful image sizes for use in Add Media modal add_filter( 'image_size_names_choose', 'wpshout_custom_sizes' ); function wpshout_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'medium-width' => __( 'Medium Width' ,'bothainah'), 'medium-height' => __( 'Medium Height' ,'bothainah' ), 'medium-something' => __( 'Medium Something','bothainah' ), ) ); } function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); if( has_post_thumbnail() ) return the_post_thumbnail( 'thumbnail' ); $output = preg_match_all('//i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img = get_template_directory_uri()."/images/default.png"; } return $first_img; } /* start logo image*/ function bothainah_theme_customizer( $wp_customize ) { $wp_customize->add_section( 'bothainah_logo_section' , array( 'title' => __( 'Logo', 'bothainah' ), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name and description in the header', ) ); $wp_customize->add_setting( 'bothainah_logo' , array( 'default' => 'content-sidebar', 'transport' => 'postMessage', 'sanitize_callback' => 'prefix_sanitize_layout', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bothainah_logo', array( 'label' => __( 'Logo', 'bothainah' ), 'section' => 'bothainah_logo_section', 'settings' => 'bothainah_logo', ) ) ); } function register_my_setting() { register_setting( 'my_options_group', 'my_option_name', 'intval' ); } add_action( 'admin_init', 'register_my_setting' ); add_action( 'customize_register', 'bothainah_theme_customizer' );/*end logo image*/ /* start menu socil media */ /** Enqueue Font Awesome from CDN if your theme hasn't already included Font Awesome **/ add_action( 'wp_enqueue_scripts', 'twp_enqueue_awesome' ); /** * Register and load font awesome CSS files using a CDN. * * @link http://www.bootstrapcdn.com/#fontawesome * @author The Web Princess */ /** * Set up Social Menu Location */ function register_my_menu() { register_nav_menu('social',__( 'Social Menu' ,'bothainah' )); } add_action( 'init', 'register_my_menu' ); /** Add your Social Menu to genesis_header - you can use other hook locations as you wish **/ add_action( 'genesis_header','twp_genesis_add_social', 10 ); /** * Set up Custom Menu for Social Icons. * * @link http://thewebprincess.com/new-genesis-social-icon-menu/ * @author The Web Princess * * @return null Return early if menu does not exist. */ function twp_genesis_add_social() { if ( ! has_nav_menu( 'social' ) ) { return; } echo '

Connect

'; $nav_args = array( 'theme_location' => 'social', 'container' => 'div', 'container_id' => 'menu-social', 'container_class' => 'menu menu-social', 'menu_id' => 'menu-social-items', 'menu_class' => 'menu-items', 'depth' => 1, 'link_before' => '', 'link_after' => '', 'fallback_cb' => '', ); wp_nav_menu( $nav_args ); } /* end menu social media*/ // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'bothainah' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'bothainah_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); } endif; add_action( 'after_setup_theme', 'bothainah_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function bothainah_content_width() { $GLOBALS['content_width'] = apply_filters( 'bothainah_content_width', 640 ); } add_action( 'after_setup_theme', 'bothainah_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function bothainah_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'bothainah' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'bothainah' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'bothainah_widgets_init' ); /** * Enqueue scripts and styles. */ function bothainah_scripts() { wp_enqueue_style( 'bothainah-style', get_stylesheet_uri() ); wp_enqueue_script( 'bothainah-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'bothainah-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'bothainah_scripts' ); /*emil*/ add_action( 'phpmailer_init', 'wpse8170_phpmailer_init' ); function wpse8170_phpmailer_init( PHPMailer $phpmailer ) { $phpmailer->Host = 'smtp.gmail.com'; $phpmailer->Port = 25; // could be different $phpmailer->Username = 'bothainah3@gmail.com'; // if required $phpmailer->Password = 'fedkm1993'; // if required $phpmailer->SMTPAuth = true; // if required // $phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value $phpmailer->IsSMTP(); } /*editor*/ add_theme_support('editor_style'); add_editor_style('styles.css'); /*add sitting*/ /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php';