'Primary Menu'
)
);
add_theme_support( 'title-tag' );
// Localization support
load_theme_textdomain('amstel', get_template_directory() . '/lang');
// Post formats
add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio' ) );
add_theme_support( 'custom-background', array(
// Background color default
'default-color' => 'fff'
// Background image default
) );
add_theme_support( "custom-header", array(
// Background color default
'default-color' => 'fff'
// Background image default
) );
// slider image
add_theme_support( 'post-thumbnails' );
add_image_size( 'full-thumb', 1080, 0, true );
add_image_size( 'slider-thumb', 1080, 530, true );
add_image_size( 'random-thumb', 300, 300, true );
// Feed Links
add_theme_support( 'automatic-feed-links' );
}
}
/*
// Register & enqueue styles/scripts
*/
add_action( 'wp_enqueue_scripts','vinethemes_add_scripts' );
function vinethemes_add_scripts() {
// Register scripts and styles
wp_register_style('ct_style', get_stylesheet_directory_uri() . '/style.css');
wp_register_style('fontawesome-css', get_template_directory_uri() . '/css/font-awesome.min.css');
wp_register_style('ct_slider-css', get_template_directory_uri() . '/css/jquery.ct_slider.css');
wp_register_style('responsive', get_template_directory_uri() . '/css/responsive.css');
wp_register_script('slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', 'jquery', '', true);
wp_register_script('ct_slider', get_template_directory_uri() . '/js/jquery.ct_slider.min.js', 'jquery', '', true);
wp_register_script('fitvids', get_template_directory_uri() . '/js/fitvids.js', 'jquery', '', true);
wp_register_script('ct_scripts', get_template_directory_uri() . '/js/vinethemes.js', 'jquery', '', true);
// Enqueue scripts and styles
wp_enqueue_style('ct_style');
wp_enqueue_style('fontawesome-css');
wp_enqueue_style('ct_slider-css');
if(!get_theme_mod('ct_responsive')) {
wp_enqueue_style('responsive');
}
// Fonts
wp_enqueue_style('default_body_font', 'http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic&subset=latin,latin-ext');
wp_enqueue_style('default_heading_font', 'https://fonts.googleapis.com/css?family=Arimo:400,700');
// JS
wp_enqueue_script('jquery');
wp_enqueue_script('slicknav');
wp_enqueue_script('ct_slider');
wp_enqueue_script('fitvids');
wp_enqueue_script('ct_scripts');
if (is_singular() && get_option('thread_comments')) wp_enqueue_script('comment-reply');
}
/*
// Include files
*/
// Theme Options
include('functions/customizer/ct_custom_controller.php');
include('functions/customizer/ct_customizer_settings.php');
include('functions/customizer/ct_customizer_style.php');
// Widgets
include("inc/widgets/about_widget.php");
include("inc/widgets/social_widget.php");
include("inc/widgets/post_widget.php");
include("inc/widgets/facebook_widget.php");
/*
// Register widgets
*/
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Sidebar',
'id' => 'sidebar-1',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => 'Instagram Footer',
'id' => 'sidebar-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
'description' => 'Use the "Instagram" widget here. IMPORTANT: For best result set number of photos to 7.',
));
/*
register_sidebar(array(
'name' => 'Below Slider Area',
'id' => 'sidebar-3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
'description' => 'Add your Subscription Widget here to see it just below the Slider. You may add other widgets as well.',
));
*/
}
/*
// COMMENTS LAYOUT
*/
function ct_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
id="comment-">
= 2 || $page >= 2 ) && ! is_404() ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'amstel' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'vinethemes_wp_title', 10, 2 );
/*
// TWITTER AMPERSAND ENTITY DECODE
*/
function vinethemes_social_title( $title ) {
$title = html_entity_decode( $title );
$title = urlencode( $title );
return $title;
}
/*
// THE EXCERPT
*/
function custom_excerpt_length( $length ) {
return 200;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function ct_string_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit) {
array_pop($words);
}
return implode(' ', $words);
}
function getCategory()
{
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category) {
$category_display = '';
$category_link = '';
if (class_exists('WPSEO_Primary_Term')) {
// Show the post's 'Primary' category, if this Yoast feature is available, & one is set
$wpseo_primary_term = new WPSEO_Primary_Term('category', get_the_id());
$wpseo_primary_term = $wpseo_primary_term->get_primary_term();
$term = get_term($wpseo_primary_term);
if (is_wp_error($term)) {
// Default to first category (not Yoast) if an error is returned
$category_display = $category[0]->name;
$category_link = get_category_link($category[0]->term_id);
} else {
// Yoast Primary category
$category_display = $term->name;
$category_link = get_category_link($term->term_id);
}
} else {
// Default, display the first category in WP's list of assigned categories
$category_display = $category[0]->name;
$category_link = get_category_link($category[0]->term_id);
}
// Display category
if (!empty($category_display)) {
if ($useCatLink == true && !empty($category_link)) {
echo '';
echo '' . htmlspecialchars($category_display) . '';
echo '';
} else {
echo '' . htmlspecialchars($category_display) . '';
}
}
}
}
//vinethemes Views Counter
function getCTcounterViews($postID){
$views_key = 'post_views_count';
$count = get_post_meta($postID, $views_key, true);
if($count==''){
delete_post_meta($postID, $views_key);
add_post_meta($postID, $views_key, '0');
return "View 0";
}
return $count.' Views';
}
function setCTcounterViews($postID) {
$views_key = 'post_views_count';
$count = get_post_meta($postID, $views_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $views_key);
add_post_meta($postID, $views_key, '0');
}else{
$count++;
update_post_meta($postID, $views_key, $count);
}
}
// Remove issues with prefetching adding extra views
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
/**
* This file represents an example of the code that themes would use to register
* the required plugins.
*
* It is expected that theme authors would copy and paste this code into their
* functions.php file, and amend to suit.
*
* @package TGM-Plugin-Activation
* @subpackage Example
* @version 2.4.1
* @author Thomas Griffin
* @author Gary Jones
* @copyright Copyright (c) 2012, Thomas Griffin
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
* @link https://github.com/thomasgriffin/TGM-Plugin-Activation
*/
/**
* Include the TGM_Plugin_Activation class.
*/
require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
* In this example, we register two plugins - one included with the TGMPA library
* and one from the .org repo.
*
* The variable passed to tgmpa_register_plugins() should be an array of plugin
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function my_theme_register_required_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(
// This is an example of how to include a plugin pre-packaged with a theme
array(
'name' => 'WP Instagram Widget', // The plugin name
'slug' => 'wp-instagram-widget', // The plugin slug (typically the folder name)
'required' => false, // If false, the plugin is only 'recommended' instead of required
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
),
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
'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
'external_url' => '', // If set, overrides default API URL and points to an external URL
)
);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'amstel';
/**
* Array of configuration settings. Amend each line as needed.
* If you want the default strings to be available under your own theme domain,
* leave the strings uncommented.
* Some of the strings are added into a sprintf, so see the comments at the
* end of each line for what each argument will be.
*/
$config = array(
'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme.
'default_path' => '', // Default absolute path to pre-packaged plugins
/*'parent_menu_slug' => 'themes.php', // Default parent menu slug
'parent_url_slug' => 'themes.php', // Default parent URL slug
*/'menu' => 'install-required-plugins', // Menu slug
'has_notices' => true, // Show admin notices or not
'is_automatic' => false, // Automatically activate plugins after installation or not
'message' => '', // Message to output right before the plugins table
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'amstel' ),
'menu_title' => __( 'Install Plugins', 'amstel' ),
'installing' => __( 'Installing Plugin: %s', 'amstel' ), // %1$s = plugin name
'oops' => __( 'Something went wrong with the plugin API.', 'amstel' ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ,'amstel'), // %1$s = plugin name(s)
'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ,'amstel'), // %1$s = plugin name(s)
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.','amstel' ), // %1$s = plugin name(s)
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ,'amstel'), // %1$s = plugin name(s)
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ,'amstel'), // %1$s = plugin name(s)
'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.','amstel' ), // %1$s = plugin name(s)
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ,'amstel'), // %1$s = plugin name(s)
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.','amstel' ), // %1$s = plugin name(s)
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ,'amstel'),
'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ,'amstel'),
'return' => __( 'Return to Required Plugins Installer', 'amstel' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'amstel' ),
'complete' => __( 'All plugins installed and activated successfully. %s', 'amstel' ), // %1$s = dashboard link
'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
)
);
tgmpa( $plugins, $config);
}
/* REGISTER WIDGETS ------------------------------------------------------------*/
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Footer Left',
'id' => 'footer-left-widget',
'description' => 'Left Footer widget position.',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => 'Footer Center',
'id' => 'footer-center-widget',
'description' => 'Centre Footer widget position.',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
register_sidebar(array(
'name' => 'Footer Right',
'id' => 'footer-right-widget',
'description' => 'Right Footer widget position.',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
}