-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
87 lines (71 loc) · 2.1 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
*
* YADO Theme functions and definitions
*
* Sets up the theme and provides some helper functions, which are used
* in the theme as custom template tags. Others are attached to action and
* filter hooks in WordPress to change core functionality.
*
* @package yadoapp
* @subpackage yadoapp
* @since 1.0
* @version 1.0
*
*/
function yadoapp_setup() {
// Make theme available for translation
load_theme_textdomain( 'yadoapp' );
// Let WordPress manage the document title
add_theme_support( 'title-tag' );
// Enable support for Post Thumbnails on posts and pages
add_theme_support( 'post-thumbnails' );
// Enable wp_nav_menu()
register_nav_menus( array(
'main' => __( 'Menú Principal', 'yadoapp' ),
'alt' => __( 'Menú Secundario', 'yadoapp' ),
'foot' => __( 'Menú Final', 'yadoapp' )
) );
}
add_action( 'after_setup_theme', 'yadoapp_setup' );
/**
*
* Filter the page title
*
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
*
* @since 1.0
* @version 1.0
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string Filtered title.
*
*/
function yadoapp_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
// Add the site name.
$title .= get_bloginfo( 'name', 'display' );
// 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 ) && ! is_404() )
$title = "$title $sep " . sprintf( __( 'Page %s', 'yadoapp' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'yadoapp_wp_title', 10, 2 );
/**
*
* Enqueue styles and scripts
*
* @since 1.0
* @version 1.0
*
*/
require( get_template_directory() . '/inc/enqueue/load-scripts.php' );
require( get_template_directory() . '/inc/enqueue/load-styles.php' );