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(672, 372, true); add_image_size('basico-full-width', 1038, 576, true); // This theme uses wp_nav_menu() in two locations. register_nav_menus(array( 'primary' => __('Top primary menu', 'basico') )); } } // basico_setup add_action('after_setup_theme', 'basico_setup'); /** * Enqueue scripts and styles for the front end. * * @since Basico 1.0 */ function basico_scripts() { $options = basico_get_options(); if($options['basico_cdn']=="cdn"){ // Add fontawesome css, used in the main stylesheet. wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css', array(), '4.2.0 '); // Add fontawesome css, used in the main stylesheet. wp_register_style('bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css', array(), '3.3.1'); wp_register_script('basico-jquery','//code.jquery.com/jquery-1.11.2.min.js',array(),false,true); wp_register_script('basico-bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js', array('basico-jquery'),false,true); }else { // Add fontawesome font, used in the main stylesheet. wp_register_style('fontawesome', get_template_directory_uri() . '/fonts/fontawesome-webfont.svg', array(), null); // Add fontawesome css, used in the main stylesheet. wp_register_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array('fontawesome'), '4.2.0'); // Add fontawesome css, used in the main stylesheet. wp_register_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.1 '); wp_register_script('basico-jquery', get_template_directory_uri() . '/js/jquery-1.11.2.min.js',array(),false,true); wp_register_script('basico-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('basico-jquery'),false,true); } // Load our main stylesheet. wp_register_style('basico-style', get_stylesheet_uri()); wp_enqueue_script('basico-bootstrap'); wp_enqueue_style('font-awesome'); wp_enqueue_style('bootstrap'); wp_enqueue_style('basico-style'); } add_action('wp_enqueue_scripts', 'basico_scripts'); function basico_get_sidebar($name) { $options = basico_get_options(); //get default sidebar if the other two are disabled if ($name == 'rigth') { if (($options['basico_sidebar_left'] == 'disabled') && ($options['basico_sidebar_rigth'] == 'disabled') && ($options['basico_sidebar_default'] == 'enabled')) { get_sidebar(); } } if ($options['basico_sidebar_left'] == $name) { get_sidebar('left'); } if ($options['basico_sidebar_rigth'] == $name) { get_sidebar('rigth'); } } function basico_get_colSize() { $options = basico_get_options(); $classPost = 12; if ($options['basico_sidebar_left'] != 'disabled' && is_active_sidebar('sidebar-left')) { $classPost-=3; } if ($options['basico_sidebar_rigth'] != 'disabled' && is_active_sidebar('sidebar-rigth')) { $classPost-=3; } if ($options['basico_sidebar_rigth'] == 'disabled' && $options['basico_sidebar_left'] == 'disabled' && $options['basico_sidebar_default'] == 'enabled') { $classPost-=3; } return $classPost; } //add menu require get_template_directory() . '/inc/menu.inc.php'; /** * Display navigation to next/previous set of posts when applicable. * * @since Basico 1.0 * * @global WP_Query $wp_query WordPress Query object. * @global WP_Rewrite $wp_rewrite WordPress Rewrite object. */ function basico_paging_nav() { global $wp_query, $wp_rewrite; // Don't print empty markup if there's only one page. if ($wp_query->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array( 'base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'basico'), 'next_text' => __('Next →', 'basico'), )); if ($links) { ?> 1 && get_option('page_comments')) { ?> 'all')) echo "nicolas"; basico_add_date_tag_category_help($html, basico_create_link(get_the_tags(), 'tag')); } if ($options['basico_category'] == $name) { basico_add_date_tag_category_help($html, basico_create_link(wp_get_post_categories(get_the_ID(), array('fields' => 'all')), 'category')); } if (!empty($html)) { if ($name == 'title') { $html = '' . $html . ''; } else if ($name == 'footer') { $html = ' '; } } echo $html; } function basico_add_date_tag_category_help(&$html, $toAdd) { if (!empty($html)) { if (!empty($toAdd)) { $html.=' | '; } } if (!empty($toAdd)) { $html.=$toAdd; } } function basico_create_link($array_object_terms, $type) { $link = ''; foreach ($array_object_terms as $object_terms) { $link.=' ' . $object_terms->name . ','; } return substr($link, 0, -1); } function basico_get_script() { $options = basico_get_options(); if (!empty($options['basico_script'])) { echo $options['basico_script']; } } function basico_get_notice() { $options = basico_get_options(); if ($options['basico_powered'] == 'yes') { ?> | __('Global Options', 'basico'), 'id' => 'basico_global_section', 'callback' => 'basico_display_section', 'page' => 'basico_menu_options' ); $basico_menu_section['basico_visual_section'] = array( 'name' => __('Visual Options', 'basico'), 'id' => 'basico_visual_section', 'callback' => 'basico_display_section', 'page' => 'basico_menu_options' ); $basico_menu_section['basico_sidebar_section'] = array( 'name' => __('Sidebar Options', 'basico'), 'id' => 'basico_sidebar_section', 'callback' => 'basico_display_section', 'page' => 'basico_menu_options' ); $basico_menu_section['basico_scripts_section'] = array( 'name' => __('Script Options', 'basico'), 'id' => 'basico_scripts_section', 'callback' => 'basico_display_section', 'page' => 'basico_menu_options' ); $basico_menu_section['basico_social_section'] = array( 'name' => __('Social Options', 'basico'), 'id' => 'basico_social_section', 'callback' => 'basico_display_section', 'page' => 'basico_menu_options' ); } if (empty($basico_menu_option)) { $basico_menu_option["basico_copyrigth"] = array( 'name' => 'Copyrigth notice', 'section' => 'basico_global_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_copyrigth', 'type' => 'text', 'desc' => __('Make your own copy rigth notice, use html here if you want', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option["basico_background"] = array( 'name' => 'Jumbotron image', 'section' => 'basico_global_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_background', 'type' => 'upload', 'desc' => __('Add you image to the jumbotron, the image can be: ', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_ico'] = array( 'name' => 'ICO image', 'section' => 'basico_global_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_ico', 'type' => 'upload', 'desc' => __('Add you image ico (this will show in the browser), the format for the image you have to be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit color', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); /* $basico_menu_option['basico_meta'] = array( 'name' => 'Meta tags', 'section' => 'basico_global_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_meta', 'type' => 'checkboxs', 'desc' => __('If you want this plugin help you to add meta tags to your site ', 'basico'), 'std' => array(array('value' => 'basico_meta_description', 'text' => __('Description', 'basico')), array('value' => 'basico_meta_key', 'text' => __('Keywords', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); */ $basico_menu_option['basico_powered'] = array( 'name' => 'WordPress', 'section' => 'basico_visual_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_powered', 'type' => 'select', 'desc' => __('Show "Powered by WordPress"', 'basico'), 'std' => array(array('value' => 'yes', 'text' => __('Yes', 'basico')), array('value' => 'no', 'text' => __('No', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'yes' ); $basico_menu_option['basico_date'] = array( 'name' => 'Date', 'section' => 'basico_visual_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_date', 'type' => 'select', 'desc' => __('Chose where the date will show or not', 'basico'), 'std' => array(array('value' => 'title', 'text' => __('After the title', 'basico')), array('value' => 'footer', 'text' => __('In the footer', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'title' ); $basico_menu_option['basico_tag'] = array( 'name' => 'Tags', 'section' => 'basico_visual_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_tag', 'type' => 'select', 'desc' => __('Chose if tag will show and where', 'basico'), 'std' => array(array('value' => 'title', 'text' => __('After the title', 'basico')), array('value' => 'footer', 'text' => __('In the footer', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'title' ); $basico_menu_option['basico_category'] = array( 'name' => 'Categories', 'section' => 'basico_visual_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_category', 'type' => 'select', 'desc' => __('Chose if categories will show and where', 'basico'), 'std' => array(array('value' => 'title', 'text' => __('After the title', 'basico')), array('value' => 'footer', 'text' => __('In the footer', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'disabled' ); $basico_menu_option['basico_sidebar_default'] = array( 'name' => 'Sidebar default', 'section' => 'basico_sidebar_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_sidebar_default', 'type' => 'select', 'desc' => __('This is necesary for all theme, but you can use the others sidebars, if one of left or rigth sidebar is working this one will not show', 'basico'), 'std' => array(array('value' => 'enabled', 'text' => __('enabled', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'enabled' ); $basico_menu_option['basico_sidebar_left'] = array( 'name' => 'Sidebar Left', 'section' => 'basico_sidebar_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_sidebar_left', 'type' => 'select', 'desc' => __('Chose the sidebar Left position', 'basico'), 'std' => array(array('value' => 'left', 'text' => __('Left', 'basico')), array('value' => 'rigth', 'text' => __('Rigth', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'disabled' ); $basico_menu_option['basico_sidebar_rigth'] = array( 'name' => 'Sidebar Rigth', 'section' => 'basico_sidebar_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_sidebar_rigth', 'type' => 'select', 'desc' => __('Chose the sidebar Rigth position', 'basico'), 'std' => array(array('value' => 'rigth', 'text' => __('Rigth', 'basico')), array('value' => 'left', 'text' => __('Left', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'disabled' ); $basico_menu_option['basico_sidebar_footer'] = array( 'name' => 'Sidebar Footer', 'section' => 'basico_sidebar_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_sidebar_footer', 'type' => 'select', 'desc' => __('Chose Quantity in sidebar footer', 'basico'), 'std' => array(array('value' => '2', 'text' => __('Two', 'basico')), array('value' => '3', 'text' => __('Three', 'basico')), array('value' => '4', 'text' => __('Four', 'basico')), array('value' => '6', 'text' => __('Six', 'basico')), array('value' => 'disabled', 'text' => __('Disabled', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'disabled' ); $basico_menu_option['basico_script'] = array( 'name' => 'Analytics Script', 'section' => 'basico_scripts_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_script', 'type' => 'textarea', 'desc' => __('Paste the Google Anatytics Script or other similar', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_cdn'] = array( 'name' => 'Script Location', 'section' => 'basico_scripts_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_cdn', 'type' => 'select', 'desc' => __('Use Local or CDN for the js and css of this theme', 'basico'), 'std' => array(array('value' => 'local', 'text' => __('Local', 'basico')), array('value' => 'cdn', 'text' => __('CDN', 'basico'))), 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => 'local' ); $basico_menu_option['basico_social_facebook'] = array( 'name' => 'Facebook URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_facebook', 'type' => 'text', 'desc' => __('Facebook URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_twitter'] = array( 'name' => 'Twitter URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_twitter', 'type' => 'text', 'desc' => __('Twitter URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_google'] = array( 'name' => 'Google+ URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_google', 'type' => 'text', 'desc' => __('Google+ URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_instagram'] = array( 'name' => 'Instagram URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_instagram', 'type' => 'text', 'id' => 'basico_social_instagram', 'name' => 'basico_social_instagram', 'desc' => __('Instagram URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_youtube'] = array( 'name' => 'Youtube URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_youtube', 'type' => 'text', 'desc' => __('Youtube URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_linkedIn'] = array( 'name' => 'LinkedIn URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_linkedIn', 'type' => 'text', 'desc' => __('LinkedIn URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); $basico_menu_option['basico_social_pinterest'] = array( 'name' => 'Pinterest URL', 'section' => 'basico_social_section', 'callback' => 'basico_display_setting', 'validator' => '', 'id' => 'basico_social_pinterest', 'type' => 'text', 'desc' => __('Pinterest URL', 'basico'), 'std' => '', 'label_for' => '', 'class' => '', 'enabled' => true, 'default' => '' ); } } /** * Creates a nicely formatted and more specific title element text * for output in head of document, based on current view. * * @since Basico 1.0 * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string Filtered title. */ function basico_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'basico' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'basico_wp_title', 10, 2 );