for posts and comments. add_theme_support( 'automatic-feed-links' ); // Enable support for Post Thumbnails, and declare two sizes. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 900, 600, true ); add_image_size( 'full-width', 900, 600, true ); add_image_size( 'portfoliyo_img', 900, 600, true ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => __( 'Top primary menu', 'auroelegent' ), 'secondary' => __( 'Secondary menu in left sidebar', 'auroelegent' ), ) ); /* * 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' ) ); /* * Enable support for Post Formats. * See https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); // This theme allows users to set a custom background. add_theme_support( 'custom-background', apply_filters( 'auroelegent_custom_background_args', array( 'default-color' => 'f5f5f5', ) ) ); // Add support for featured content. add_theme_support( 'featured-content', array( 'featured_content_filter' => 'auroelegent_get_featured_posts', 'max_posts' => 6, ) ); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } endif; // auroelegent_setup add_action( 'after_setup_theme', 'auroelegent_setup' ); /** * Adjust content_width value for image attachment template. * * @since Auro Elegent 1.0 */ function auroelegent_content_width() { if ( is_attachment() && wp_attachment_is_image() ) { $GLOBALS['content_width'] = 810; } } add_action( 'template_redirect', 'auroelegent_content_width' ); /** * Getter function for Featured Content Plugin. * * @since Auro Elegent 1.0 * * @return array An array of WP_Post objects. */ function auroelegent_get_featured_posts() { /** * Filter the featured posts to return in Auro Elegent. * * @since Auro Elegent 1.0 * * @param array|bool $posts Array of featured posts, otherwise false. */ return apply_filters( 'auroelegent_get_featured_posts', array() ); } /** * A helper conditional function that returns a boolean value. * * @since Auro Elegent 1.0 * * @return bool Whether there are featured posts. */ function auroelegent_has_featured_posts() { return ! is_paged() && (bool) auroelegent_get_featured_posts(); } /** * Register three Auro Elegent widget areas. * * @since Auro Elegent 1.0 */ function auroelegent_widgets_init() { require get_template_directory() . '/inc/widgets.php'; register_widget( 'Auro_Elegent_Ephemera_Widget' ); register_sidebar( array( 'name' => __( 'Primary Sidebar', 'auroelegent' ), 'id' => 'sidebar-1', 'description' => __( 'Main sidebar that appears on the left.', 'auroelegent' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Sidebar', 'auroelegent' ), 'id' => 'sidebar-2', 'description' => __( 'Additional sidebar that appears on the right.', 'auroelegent' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Area', 'auroelegent' ), 'id' => 'footer-box', 'description' => __( 'Appears in the footer section of the site.', 'auroelegent' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer copyright Area', 'auroelegent' ), 'id' => 'copyright', 'description' => __( 'Appears in the footer section of the site.', 'auroelegent' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Contact right info', 'auroelegent' ), 'id' => 'contact_info', 'description' => __( 'Appears in the footer section of the site.', 'auroelegent' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'auroelegent_widgets_init' ); /** * Register Lato Google font for Auro Elegent. * * @since Auro Elegent 1.0 * * @return string */ function auroelegent_font_url() { $font_url = ''; /* * Translators: If there are characters in your language that are not supported * by Lato, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Titillium Web font: on or off', 'auroelegent' ) ) { $query_args = array( 'family' => urlencode( 'Titillium Web:400,200,200italic,300,300italic,400italic,600,600italic,700,700italic,900' ), 'subset' => urlencode( 'latin,latin-ext' ), ); $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return $font_url; } /** * Enqueue scripts and styles for the front end. * * @since Auro Elegent 1.0 */ function auroelegent_scripts() { // Add Lato font, used in the main stylesheet. wp_enqueue_style( 'auroelegent-lato', auroelegent_font_url(), array(), null ); // Add Genericons font, used in the main stylesheet. wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' ); // Load our main stylesheet. wp_enqueue_style( 'auroelegent-style', get_stylesheet_uri() ); // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'auroelegent-ie', get_template_directory_uri() . '/css/ie.css', array( 'auroelegent-style' ), '20131205' ); wp_style_add_data( 'auroelegent-ie', 'conditional', 'lt IE 9' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'auroelegent-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' ); } if ( is_active_sidebar( 'sidebar-3' ) ) { wp_enqueue_script( 'jquery-masonry' ); } if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) { wp_enqueue_script( 'auroelegent-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true ); wp_localize_script( 'auroelegent-slider', 'featuredSliderDefaults', array( 'prevText' => __( 'Previous', 'auroelegent' ), 'nextText' => __( 'Next', 'auroelegent' ) ) ); } wp_enqueue_script( 'auroelegent-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150315', true ); } add_action( 'wp_enqueue_scripts', 'auroelegent_scripts' ); /** * Enqueue Google fonts style to admin screen for custom header display. * * @since Auro Elegent 1.0 */ function auroelegent_admin_fonts() { wp_enqueue_style( 'auroelegent-lato', auroelegent_font_url(), array(), null ); } add_action( 'admin_print_scripts-appearance_page_custom-header', 'auroelegent_admin_fonts' ); if ( ! function_exists( 'auroelegent_the_attached_image' ) ) : /** * Print the attached image with a link to the next attached image. * * @since Auro Elegent 1.0 */ function auroelegent_the_attached_image() { $post = get_post(); /** * Filter the default Auro Elegent attachment size. * * @since Auro Elegent 1.0 * * @param array $dimensions { * An array of height and width dimensions. * * @type int $height Height of the image in pixels. Default 810. * @type int $width Width of the image in pixels. Default 810. * } */ $attachment_size = apply_filters( 'auroelegent_attachment_size', array( 810, 810 ) ); $next_attachment_url = wp_get_attachment_url(); /* * Grab the IDs of all the image attachments in a gallery so we can get the URL * of the next adjacent image in a gallery, or the first image (if we're * looking at the last image in a gallery), or, in a gallery of one, just the * link to that image file. */ $attachment_ids = get_posts( array( 'post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', ) ); // If there is more than 1 attachment in a gallery... if ( count( $attachment_ids ) > 1 ) { foreach ( $attachment_ids as $attachment_id ) { if ( $attachment_id == $post->ID ) { $next_id = current( $attachment_ids ); break; } } // get the URL of the next image attachment... if ( $next_id ) { $next_attachment_url = get_attachment_link( $next_id ); } // or get the URL of the first image attachment. else { $next_attachment_url = get_attachment_link( reset( $attachment_ids ) ); } } printf( '%2$s', esc_url( $next_attachment_url ), wp_get_attachment_image( $post->ID, $attachment_size ) ); } endif; if ( ! function_exists( 'auroelegent_list_authors' ) ) : /** * Print a list of all site contributors who published at least one post. * * @since Auro Elegent 1.0 */ function auroelegent_list_authors() { $contributor_ids = get_users( array( 'fields' => 'ID', 'orderby' => 'post_count', 'order' => 'DESC', 'who' => 'authors', ) ); foreach ( $contributor_ids as $contributor_id ) : $post_count = count_user_posts( $contributor_id ); // Move on if user has not published a post (yet). if ( ! $post_count ) { continue; } ?>
= 2 || $page >= 2 ) && ! is_404() ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'auroelegent' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'auroelegent_wp_title', 10, 2 ); add_theme_support( "title-tag" ); // Implement Custom Header features. //require get_template_directory() . '/inc/custom-header.php'; // Custom template tags for this theme. require get_template_directory() . '/inc/template-tags.php'; // Add Customizer functionality. //require get_template_directory() . '/inc/customizer.php'; /* * Add Featured Content functionality. * * To overwrite in a plugin, define your own Featured_Content class on or * before the 'setup_theme' hook. */ if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) { // require get_template_directory() . '/inc/featured-content.php'; } function my_login_page() { ?> admin_url( 'admin-ajax.php' ), 'redirecturl' => home_url(), 'loadingmessage' => __('Sending user info, please wait...','auroelegent') )); // Enable the user with no privileges to run ajax_login() in AJAX add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' ); } // Execute the action only if the user isn't logged in if (!is_user_logged_in()) { add_action('init', 'ajax_login_init'); } function ajax_login(){ // First check the nonce, if it fails the function will break check_ajax_referer( 'ajax-login-nonce', 'security' ); // Nonce is checked, get the POST data and sign user on $info = array(); $info['user_login'] = $_POST['name']; $info['user_password'] = $_POST['password']; $info['remember'] = true; $user_signon = wp_signon( $info, false ); if ( is_wp_error($user_signon) ){ echo json_encode(array('loggedin'=>false, 'message'=>__('Wrong username or password.','auroelegent'))); } else { echo json_encode(array('loggedin'=>true, 'message'=>__('Login successful, redirecting...','auroelegent'))); } die(); } add_action( 'login_enqueue_scripts', 'my_login_page' ); function my_login_logo_url() { return home_url(); } add_filter( 'login_headerurl', 'my_login_logo_url' ); add_action('wp_logout','go_home'); function go_home(){ wp_redirect( home_url() ); exit(); } /* Disable WordPress Admin Bar for all users but admins. */ show_admin_bar(false); /** * Since I'm already doing a tutorial, I'm not going to include comments to * this code, but if you want, you can check out the "example.php" file * inside the ZIP you downloaded - it has a very detailed documentation. */ require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); /** * Register the required plugins for this theme. * * In this example, we register five plugins: * - one included with the TGMPA library * - two from an external source, one from an arbitrary source, one from a GitHub repository * - two from the .org repo, where one demonstrates the use of the `is_callable` argument * * The variable passed to tgmpa_register_plugins() should be an array of plugin * arrays. * * This function is hooked into tgmpa_init, which is fired within the * TGM_Plugin_Activation class constructor. */ function my_theme_register_required_plugins() { /* * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( // This is an example of how to include a plugin bundled with a theme. array( 'name' => 'Advanced Custom Fields', // The plugin name. 'slug' => 'advanced-custom-fields', // The plugin slug (typically the folder name). 'source' => get_stylesheet_directory() . '/plugins/advanced-custom-fields.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), // This is an example of how to include a plugin from the WordPress Plugin Repository. array( 'name' => 'BuddyPress', 'slug' => 'buddypress', 'required' => true, ), array( 'name' => 'portfolio', // The plugin name. 'slug' => 'portfolio', // The plugin slug (typically the folder name). 'source' => get_stylesheet_directory() . '/plugins/portfolio.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), array( 'name' => 'services', // The plugin name. 'slug' => 'services', // The plugin slug (typically the folder name). 'source' => get_stylesheet_directory() . '/plugins/services.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), array( 'name' => 'slider', // The plugin name. 'slug' => 'slider', // The plugin slug (typically the folder name). 'source' => get_stylesheet_directory() . '/plugins/slider.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), array( 'name' => 'testimonials', // The plugin name. 'slug' => 'testimonials', // The plugin slug (typically the folder name). 'source' => get_stylesheet_directory() . '/plugins/testimonials.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin. 'force_activation' => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'parent_slug' => 'themes.php', // Parent menu slug. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); }