-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
168 lines (138 loc) · 4.83 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?
/*
Theme functions
*/
include("includes/extends.php");
/**
* Enqueue scripts and styles for front-end.
*/
function likegag_scripts_styles() {
global $wp_styles;
// Adds JavaScript for handling the navigation menu hide-and-show behavior.
wp_enqueue_script( 'bootstrap-script', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery' ), '20140630' );
wp_enqueue_script( 'utils-script', get_template_directory_uri() . '/assets/js/utils.js', array( 'jquery' ), '20140702' );
// Loads our main stylesheet.
wp_enqueue_style( 'likegag-bootstrap-style', get_template_directory_uri()."/assets/css/bootstrap.min.css" );
wp_enqueue_style( 'likegag-style', get_stylesheet_uri(),array('likegag-bootstrap-style') );
// Loads the Fonts
wp_enqueue_style( 'open-sans', '', array( 'twentytwelve-style' ), '20140630' );
$wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'likegag_scripts_styles' );
/**
* Filter the page title.
*
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
*
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string Filtered title.
*/
function likegag_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 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'likegag_wp_title', 10, 2 );
/**
* Setup the Navs a Theme Support.
*
*/
function likegag_setup() {
// Adds RSS feed links to <head> for posts and comments.
add_theme_support( 'automatic-feed-links' );
// This theme supports a variety of post formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'leftmenu', __( 'Left Menu', 'likegag' ) );
register_nav_menu( 'rightmenu', __( 'Right Menu', 'likegag' ) );
// This theme uses a custom image size for featured images, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
add_image_size('likegag-post-width', 524, 9999 );
//Add labels for media library
add_filter( 'image_size_names_choose', 'likegag_custom_sizes' );
//Register sidebar widgets
$args = array(
'name' => __('Right Sidebar'),
'id' => 'right-sidebar',
'description' => '',
'class' => '',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '' );
register_sidebars(1, $args);
}
add_action( 'after_setup_theme', 'likegag_setup' );
/**
*Function to register Theme Widgets
*
*/
function likegag_theme_widgets(){
register_widget( 'LikeGag_Archives' );
}
add_action( 'widgets_init', 'likegag_theme_widgets' );
/**
* This function labal the custom sizes, for media library
*/
function likegag_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'likegag-post-width' => __('Full Container Width'),
) );
}
if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
*/
function likegag_paging_nav() {
global $wp_query;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 )
return;
?>
<ul class="pager">
<?php if ( get_next_posts_link() ) : ?>
<li><?php next_posts_link( __( '<span class="meta-nav">←</span> Anterior', 'likegag' ) ); ?></li>
<?php endif; ?>
<?php if ( get_previous_posts_link() ) : ?>
<li><?php previous_posts_link( __( 'Siguiente <span class="meta-nav">→</span>', 'likegag' ) ); ?></li>
<?php endif; ?>
</ul>
<?php
}
endif;
/**
* This function allow to add custom class to dropdowns
* Deprecated i found a better way using walkers
*/
/* function menu_set_dropdown( $sorted_menu_items, $args ) {
print_r($sorted_menu_items);
$last_top = 0;
foreach ( $sorted_menu_items as $key => $obj ) {
// it is a top lv item?
if ( 0 == $obj->menu_item_parent ) {
// set the key of the parent
$last_top = $key;
$sorted_menu_items[$last_top]->classes['dropdown'] = 'dropdown2';
} else {
$sorted_menu_items[$last_top]->classes['dropdown'] = 'dropdown';
}
}
return $sorted_menu_items;
}
add_filter( 'wp_nav_menu_objects', 'menu_set_dropdown', 10, 2 ); */
?>