* Gourmet is distributed under the terms of the GNU GPL
*/
function gourmet_customize_css()
{ ?>
true,
'width' => 980,
'flex-height' => true,
'height' => 125,
);
add_theme_support( 'custom-header', $args );
add_editor_style( get_template_directory_uri() . '/css/editor-style.css' );
add_theme_support( 'post-formats', array( 'aside','link','gallery','image','quote','status','video','audio','chat' ) );
load_theme_textdomain('gourmet', get_template_directory() . '/languages');
}
add_action('after_setup_theme', 'gourmet_callback');
//--------Settings themplate
//Add register Menu
register_nav_menu( 'primary', __( 'Navigation Menu', 'gourmet' ) );
require get_template_directory() . '/inc/settings_template.php';
//--------IE-------
add_action( 'wp_head', 'gourmet_head_callback' );
function gourmet_head_callback() {
global $wp_styles;
wp_enqueue_style( 'gourmet-ie', get_template_directory_uri() . "/css/ie.css", array( 'gourmet' ) );
$wp_styles->add_data( 'gourmet-ie', 'conditional', 'lt IE 8' );
?>
__( 'SideBar Left', 'traveler' ),
'id' => 'sidebar_left',
'description' => __( 'Appears in the left column of the site.', 'traveler' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'SideBar Right', 'traveler' ),
'id' => 'sidebar_right',
'description' => __( 'Appears in the right column of the site.', 'traveler' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'gourmet_sidebar_init' );
//css styles connect to the admin
function gourmet_style_backend() {
wp_enqueue_style( 'admin_style', get_template_directory_uri() . '/css/admin_style.css' );
wp_enqueue_style( 'font-awesomes', get_template_directory_uri() . "/css/font-awesome.min.css" );
}
add_action( 'admin_enqueue_scripts', 'gourmet_style_backend' );
//styles and scripts
function gourmet_rigistre_scripts() {
$gourmet_uri = get_template_directory_uri();
wp_enqueue_script('gourmet_bootstrap_script', $gourmet_uri . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), false);
wp_enqueue_script('gourmet_custom_script', $gourmet_uri . '/js/custom.js', array( 'jquery' ), true);
wp_enqueue_script('gourmet_viewportchecker_script', $gourmet_uri . '/js/viewportchecker.js', array( 'jquery' ), false);
wp_enqueue_script( 'gourmet_script', $gourmet_uri . '/js/functions.js', array( 'jquery' ), '20140319', true );
wp_enqueue_style('gourmet_bootstrap_style', get_template_directory_uri() . '/bootstrap/css/bootstrap.css');
wp_enqueue_style('gourmet_main_style', get_stylesheet_uri(), array() );
wp_enqueue_style( 'gourmet_animate_style', get_template_directory_uri() . '/css/animate.css');
wp_enqueue_style('gourmet_font-awesome_style', get_template_directory_uri() . '/css/font-awesome.min.css');
wp_enqueue_style('gourmet_fonts','http://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic|Special+Elite|Orbitron:400,500,700,900|Alegreya+SC:400,400italic,700,700italic,900,900italic|Comfortaa:400,300,700|Abel|Dosis:400,200,300,500,600,700,800|Droid+Sans:400,700|Francois+One|Exo:100,200,300,400,500,600,700,800,900,100italic,200italic,300italic,400italic,500italic,600italic,700italic,800italic,900italic|Tangerine:400,700|Josefin+Sans:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic|Lato:400,100,300,400italic,300italic,100italic,700,700italic,900,900italic|Lobster|Lora:400,400italic,700,700italic|Oswald:300,400,700|Open+Sans+Condensed:300,300italic,700|Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800italic,800|Oswald:400,300,700|Oxygen:400,300,700|PT+Sans+Narrow:400,700|PT+Sans:400,400italic,700,700italic|Prosto+One|Quicksand:400,300,700|Roboto+Condensed:400,300,300italic,400italic,700,700italic|Share:400,400italic,700,700italic|Source+Sans+Pro:400,200,200italic,300,300italic,400italic,600,600italic,700,700italic,900,900italic|Ubuntu+Condensed|Ubuntu:400,300,300italic,400italic,500,500italic,700,700italic|Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic&subset=latin,cyrillic-ext,latin-ext,cyrillic');
}
add_action( 'wp_enqueue_scripts', 'gourmet_rigistre_scripts' );
//Paginator Post Blog
function gourmet_pagenavi_blog($post_type ='', $posts_per_page = 6) {
if($post_type == "") $count_posts = wp_count_posts();
else $count_posts = wp_count_posts($post_type);
$big = 999999999;
$args = array(
'gourmet' => str_replace( $big, '%#%', get_pagenum_link( $big, false ) )
,'format' => ''
,'current' => max( 1, get_query_var('paged') )
,'total' => ceil($count_posts->publish/$posts_per_page )
);
$result = paginate_links( $args );
$result = str_replace( '/page/1"', '"', $result );
echo $result;
}
//Paginator Post Caregory
function gourmet_pagenavi_category($posts_all, $posts_page_cat = 1) {
$big = 999999989;
$args = array(
'gourmet' => str_replace( $big, '%#%', get_pagenum_link( $big, false ) )
,'format' => ''
,'current' => max( 1, get_query_var('paged') )
,'total' => ceil($posts_all/$posts_page_cat )
);
$result = paginate_links( $args );
$result = str_replace( '/page/1"', '"', $result );
echo $result;
}
function gourmet_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
' . __( 'Sticky', 'gourmet' ) . '';
if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
gourmet_entry_date();
// Translators: used between list items, there is a space after the comma.
$categories_list = get_the_category_list( __( ', ', 'gourmet' ) );
if ( $categories_list ) {
echo '' . $categories_list . '';
}
// Translators: used between list items, there is a space after the comma.
$tag_list = get_the_tag_list( '', __( ', ', 'gourmet' ) );
if ( $tag_list ) {
echo '' . $tag_list . ': ';
}
// Post author
if ( 'post' == get_post_type() ) {
printf( '%3$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'gourmet' ), get_the_author() ) ),
get_the_author()
);
}
};
function gourmet_entry_date( $echo = true ) {
if ( has_post_format( array( 'chat', 'status' ) ) )
$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'gourmet' );
else
$format_prefix = '%2$s';
$date = sprintf( '',
esc_url( get_permalink() ),
esc_attr( sprintf( __( 'Permalink to %s', 'gourmet' ), the_title_attribute( 'echo=0' ) ) ),
esc_attr( get_the_date( 'c' ) ),
esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
);
if ( $echo )
echo $date;
return $date;
};
function gourmet_the_attached_image() {
/**
* Filter the image attachment size to use.
* @param array $size {
* @type int The attachment height in pixels.
* @type int The attachment width in pixels.
* }
*/
$attachment_size = apply_filters( 'gourmet_attachment_size', array( 724, 724 ) );
$next_attachment_url = wp_get_attachment_url();
$post = get_post();
/*
* 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( array_shift( $attachment_ids ) );
}
printf( '%3$s',
esc_url( $next_attachment_url ),
the_title_attribute( array( 'echo' => false ) ),
wp_get_attachment_image( $post->ID, $attachment_size )
);
}
//content limit
function gourmet_content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}