/**
* restauracion functions and definitions
*
* @package restauracion
*/
if ( ! function_exists( 'restauracion_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function restauracion_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on restauracion, use a find and replace
* to change 'restauracion' to the name of your theme in all the template files
*/
load_theme_textdomain( 'restauracion', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
// set_post_thumbnail_size( 571, 373, true );
// add_image_size( 'slider-thumb', 492, 318, array( 'center', 'center') ); // Homepage blog Images
// add_image_size( 'home-thumb', 360, 240, array( 'center', 'center') ); // Homepage blog Images
// add_image_size( 'portfolio-thumb', 860, 620, false ); // Archive Pages
// add_image_size( 'single-thumb', 860, 620, false ); // Single Pages
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'restauracion' ),
'secondary' => esc_html__( 'Footer Menu', 'restauracion' ),
) );
/*
* 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',
) );
/* add_theme_support( 'custom-logo', array(
'height' => 55,
'width' => 150,
'flex-height' => true,
'flex-width' => true,
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'restauracion_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support( "custom-header",
array(
'default-color' => 'ffffff',
'default-image' => '',
)
);*/
/*
* Enable support for Selective Refresh for Widgets.
* See https://make.wordpress.org/core/2016/11/10/visible-edit-shortcuts-in-the-customizer-preview/
*/
// add_theme_support( 'customize-selective-refresh-widgets' );
// add_editor_style() ;
}
endif; // restauracion_setup
add_action( 'after_setup_theme', 'restauracion_setup' );
/**
* Enqueue scripts and styles.
*/
function restauracion_scripts() {
wp_enqueue_style( 'restauracion-bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css' );
$query_args = array('family' => 'Archivo+Narrow');
wp_enqueue_style( 'google-fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css' );
wp_enqueue_style( 'slick-style', get_template_directory_uri() . "/css/slick.css" );
wp_enqueue_style( 'slick-theme', get_template_directory_uri() . "/css/slick-theme.css" );
wp_enqueue_style( 'restauracion-style', get_stylesheet_uri() );
wp_enqueue_style( 'customcss', get_template_directory_uri() . '/css/custom.css' );
//wp_enqueue_script('jquery');
wp_enqueue_script( 'restauracion-nav', get_template_directory_uri() . '/js/navigation.js', array(), '1.0.0', true );
//wp_enqueue_script( 'restauracion-bootstrap-min1', '//code.jquery.com/jquery-3.2.1.slim.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'restauracion-bootstrap-min2', '//cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'restauracion-bootstrap-min3', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'slickjs', get_template_directory_uri() . '/js/slick.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'cycle2', get_template_directory_uri() . '/js/jquery.cycle2.min.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script( 'restauracion-scripts', get_template_directory_uri() . '/js/scripts.js', array(), '1.0.1', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'restauracion_scripts' );
function my_nav_menu_objects( $sorted_menu_items, $args )
{
// Annotate all menu items with children with a CSS class 'menu-item-has-children'
$menu_items_with_children = array();
foreach ( (array) $sorted_menu_items as $key => $menu_item )
{
if ($menu_item->menu_item_parent)
{
$menu_items_with_children[$menu_item->menu_item_parent] = true;
}
}
foreach ( (array) $sorted_menu_items as $key => $menu_item )
{
if (isset($menu_items_with_children[$menu_item->db_id]))
{
$menu_item->classes = array_merge( $menu_item->classes, array("menu-item-has-children") );
}
}
return $sorted_menu_items;
}
// Don't forget to register the required filter.
add_filter( 'wp_nav_menu_objects', 'my_nav_menu_objects', 10 /* LAST! */, 2);
require get_template_directory() . '/inc/post_type.php';
require get_template_directory() . '/breadcrumbs.php';
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
if ( ! isset( $content_width ) ) $content_width = 900;
function restauracion_content_width() {
$GLOBALS['content_width'] = apply_filters( 'restauracion_content_width', 640 );
}
add_action( 'after_setup_theme', 'restauracion_content_width', 0 );
function restauracion_filter_front_page_template( $template ) {
return is_home() ? '' : $template;
}
add_filter( 'front_page_template', 'restauracion_filter_front_page_template' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function restauracion_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Footer', 'restauracion' ),
'id' => 'footer',
'description' => __('Footer Widget', 'restauracion'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'restauracion_widgets_init' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
//require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
//require get_template_directory() . '/inc/customizer.php';
/**
* Load TGM plugin
*/
//require get_template_directory() . '/inc/class-tgm-plugin-activation.php';
/* Recommended plugin using TGM */
add_action( 'tgmpa_register', 'restauracion_register_plugins');
if( !function_exists('restauracion_register_plugins') ) {
function restauracion_register_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(
array(
'name' => 'One Click Demo Import', // The plugin name.
'slug' => 'one-click-demo-import', // The plugin slug (typically the folder name).
'required' => false, // If false, the plugin is only 'recommended' instead of required.
),
array(
'name' => 'Contact Form 7', // The plugin name.
'slug' => 'contact-form-7', // The plugin slug (typically the folder name).
'required' => false, // If false, the plugin is only 'recommended' instead of required.
),
);
/*
* 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 );
}
}
//add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
// Menu Fallback
function restauracion_wp_nav_default_primary_menu() {
get_template_part( 'template-parts/default-primary-menu' );
}
function restauracion_wp_nav_default_secondary_menu() {
get_template_part( 'template-parts/default-secondary-menu' );
}
add_action("template_redirect", 'my_template_redirect');
function my_template_redirect()
{
global $wp_query, $post, $posts;
if (isset($wp_query->query_vars['bptproject']) && $wp_query->query_vars['bptproject']!="")
{
// Let's look for the property.php template file in the current theme
include(TEMPLATEPATH . '/bptbootstrap-single.php');
die();
}
}
/**
*
* Get option
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'cs_get_option' ) ) {
function cs_get_option( $option_name = '', $default = '' ) {
$options = apply_filters( 'cs_get_option', get_option( '_cs_options' ), $option_name, $default );
if( ! empty( $option_name ) && ! empty( $options[$option_name] ) ) {
return $options[$option_name];
} else {
return ( ! empty( $default ) ) ? $default : null;
}
}
}
/**
*
* Set option
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'cs_set_option' ) ) {
function cs_set_option( $option_name = '', $new_value = '' ) {
$options = apply_filters( 'cs_set_option', get_option( '_cs_options' ), $option_name, $new_value );
if( ! empty( $option_name ) ) {
$options[$option_name] = $new_value;
update_option( '_cs_options', $options );
}
}
}
require get_template_directory() . '/framework/cs-framework.php';
/**
*
* Get all option
*
* @since 1.0.0
* @version 1.0.0
*
*/
if ( ! function_exists( 'cs_get_all_option' ) ) {
function cs_get_all_option() {
return get_option( '_cs_options' );
}
}