__( 'Primary Menu', 'wp-setmore' ),
'secondary' => __('Footer Menu', 'wp-setmore')
) );
add_theme_support('post-thumbnails');
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
// custom backgrounds
$wp_setmore_custom_background = array(
// Background color default
'default-color' => 'ffffff',
'default-repeat'=>'no-repeat',
'default-position-x'=>'center',
'default-attachment' => 'fixed',
// Background image default
'default-image' => '',
'wp-head-callback' => '_custom_background_cb'
);
add_theme_support('custom-background', $wp_setmore_custom_background );
// adding post format support
add_theme_support( 'post-formats',
array(
'aside', /* Typically styled without a title. Similar to a Facebook note update */
'gallery', /* A gallery of images. Post will likely contain a gallery shortcode and will have image attachments */
'link', /* A link to another site. Themes may wish to use the first link tag in the post content as the external link for that post. An alternative approach could be if the post consists only of a URL, then that will be the URL and the title (post_title) will be the name attached to the anchor for it */
'image', /* A single image. The first tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image */
'quote', /* A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title */
'status', /*A short status update, similar to a Twitter status update */
'video', /* A single video. The first tag or object/embed in the post content could be considered the video. Alternatively, if the post consists only of a URL, that will be the video URL. May also contain the video as an attachment to the post, if video support is enabled on the blog (like via a plugin) */
'audio', /* An audio file. Could be used for Podcasting */
'chat' /* A chat transcript */
)
);
}
endif;
add_action( 'after_setup_theme', 'wp_setmore_setup' );
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! function_exists( 'wp_setmore_content_width' ) ) :
function wp_setmore_content_width() {
global $content_width;
if (!isset($content_width))
$content_width = 550; /* pixels */
}
endif;
add_action( 'after_setup_theme', 'wp_setmore_content_width' );
function theme_slug_setup() {
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'theme_slug_setup' );
if ( ! function_exists( '_wp_render_title_tag' ) ) :
function theme_slug_render_title() {
?>
remove_section( 'title_tagline');
/* logo option */
$wp_customize->add_section( 'wp_setmore_logo_section' , array(
'title' => __( 'Site Logo', 'wp-setmore' ),
'priority' => 31,
'description' => __( 'Upload a logo to replace the default site name in the header', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo', array(
'label' => __( 'Choose your logo (ideal width is 100-300px and ideal height is 40-100px)', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section',
'settings' => 'wp_setmore_logo',
) ) );
/* Background Image for Service Page */
$wp_customize->add_section( 'wp_setmore_logo_section_service' , array(
'title' => __( 'Service’s Page', 'wp-setmore' ),
'priority' => 34,
'description' => __( 'Upload a background image for your services page', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_service', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_service', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_service',
'settings' => 'wp_setmore_logo_service',
) ) );
/* Background Image for Staff Page */
$wp_customize->add_section( 'wp_setmore_logo_section_staff' , array(
'title' => __( 'Staff’s Page', 'wp-setmore' ),
'priority' => 35,
'description' => __( 'Upload a background image for your Staff’s page', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_staff', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_staff', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_staff',
'settings' => 'wp_setmore_logo_staff',
) ) );
/* Background Image for About Us Page */
$wp_customize->add_section( 'wp_setmore_logo_section_aboutus' , array(
'title' => __( 'About Us Page', 'wp-setmore' ),
'priority' => 36,
'description' => __( 'Upload a background image for your About Us page', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_aboutus', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_aboutus', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_aboutus',
'settings' => 'wp_setmore_logo_aboutus',
) ) );
/* Background Image for Contact Us Us Page */
$wp_customize->add_section( 'wp_setmore_logo_section_contactus' , array(
'title' => __( 'Contact Us Page', 'wp-setmore' ),
'priority' => 37,
'description' => __( 'Upload a background image for your Contact Us page', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_contactus', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_contactus', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_contactus',
'settings' => 'wp_setmore_logo_contactus',
) ) );
/* Background Image for Booking Page */
$wp_customize->add_section( 'wp_setmore_logo_section_booking' , array(
'title' => __( 'Booking Page', 'wp-setmore' ),
'priority' => 38,
'description' => __( 'Upload a background image for your Booking page', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_booking', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_booking', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_booking',
'settings' => 'wp_setmore_logo_booking',
) ) );
/* Background Image for Main Content */
$wp_customize->add_section( 'wp_setmore_logo_section_main_content' , array(
'title' => __( 'Main Content', 'wp-setmore' ),
'priority' => 39,
'description' => __( 'Upload a background image for your main content', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_logo_main_content', array (
'sanitize_callback' => 'esc_url_raw',
) );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'wp_setmore_logo_main_content', array(
'label' => __( '', 'wp-setmore' ),
'section' => 'wp_setmore_logo_section_main_content',
'settings' => 'wp_setmore_logo_main_content',
) ) );
/* color theme */
$wp_customize->add_setting( 'wp_setmore_theme_color', array (
'default' => '#DD3333',
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wp_setmore_theme_color', array(
'label' => __( 'Theme Color Option', 'wp-setmore' ),
'section' => 'colors',
'settings' => 'wp_setmore_theme_color',
'priority' => 101,
) ) );
/* paragraph font-color theme */
$wp_customize->add_setting( 'wp_setmore_theme_color_paragraph', array (
'default' => '#788a95',
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wp_setmore_theme_color_paragraph', array(
'label' => __( 'Paragraph Color Option', 'wp-setmore' ),
'section' => 'colors',
'settings' => 'wp_setmore_theme_color_paragraph',
'priority' => 102,
) ) );
/* author bio in posts option */
$wp_customize->add_section( 'wp_setmore_author_bio_section' , array(
'title' => __( 'Display Author Bio', 'wp-setmore' ),
'priority' => 32,
'description' => __( 'Option to show/hide the author bio in the posts.', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_author_bio', array (
'sanitize_callback' => 'wp_setmore_sanitize_checkbox',
) );
$wp_customize->add_control('author_bio', array(
'settings' => 'wp_setmore_author_bio',
'label' => __('Show the author bio in posts?', 'wp-setmore'),
'section' => 'wp_setmore_author_bio_section',
'type' => 'checkbox',
));
/* slider options */
$wp_customize->add_section( 'wp_setmore_slider_section' , array(
'title' => __( 'Slider Options', 'wp-setmore' ),
'priority' => 33,
'description' => __( 'Adjust the behavior of the image slider.', 'wp-setmore' ),
) );
$wp_customize->add_setting( 'wp_setmore_slider_effect', array(
'default' => 'scrollHorz',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control( 'effect_select_box', array(
'settings' => 'wp_setmore_slider_effect',
'label' => __( 'Select Effect:', 'wp-setmore' ),
'section' => 'wp_setmore_slider_section',
'type' => 'select',
'choices' => array(
'scrollHorz' => 'Horizontal (Default)',
'scrollVert' => 'Vertical',
'tileSlide' => 'Tile Slide',
'tileBlind' => 'Blinds',
'shuffle' => 'Shuffle',
),
));
$wp_customize->add_setting( 'wp_setmore_slider_timeout', array (
'sanitize_callback' => 'wp_setmore_sanitize_integer',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'wp_setmore_slider_timeout', array(
'label' => __( 'Autoplay Speed in Seconds', 'wp-setmore' ),
'section' => 'wp_setmore_slider_section',
'settings' => 'wp_setmore_slider_timeout',
) ) );
}
endif;
add_action('customize_register', 'wp_setmore_theme_customizer');
/**
* Sanitize checkbox
*/
if ( ! function_exists( 'wp_setmore_sanitize_checkbox' ) ) :
function wp_setmore_sanitize_checkbox( $input ) {
if ( $input == 1 ) {
return 1;
} else {
return '';
}
}
endif;
/**
* Sanitize integer input
*/
if ( ! function_exists( 'wp_setmore_sanitize_integer' ) ) :
function wp_setmore_sanitize_integer( $input ) {
return absint($input);
}
endif;
/**
* Apply Color Scheme
*/
if ( ! function_exists( 'wp_setmore_apply_color' ) ) :
function wp_setmore_apply_color() {
if ( get_theme_mod('wp_setmore_theme_color') ) {
?>
'primary', /* where in the theme it's assigned */
'container_class' => 'menu', /* div container class */
'fallback_cb' => 'wp_setmore_main_nav_fallback' /* menu fallback */
)
);
}
endif;
if ( ! function_exists( 'wp_setmore_main_nav_fallback' ) ) :
function wp_setmore_main_nav_fallback() { wp_page_menu( 'show_home=Home&container_class=menu' ); }
endif;
if ( ! function_exists( 'wp_setmore_footer_nav' ) ) :
function wp_setmore_footer_nav() {
// display the wp3 menu if available
wp_nav_menu(
array(
'theme_location' => 'secondary', /* where in the theme it's assigned */
'container_class' => 'footer-menu', /* container class */
'fallback_cb' => false,
)
);
}
endif;
if ( ! function_exists( 'wp_setmore_enqueue_comment_reply' ) ) :
function wp_setmore_enqueue_comment_reply() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
endif;
add_action( 'comment_form_before', 'wp_setmore_enqueue_comment_reply' );
if ( ! function_exists( 'wp_setmore_page_menu_args' ) ) :
function wp_setmore_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
endif;
add_filter( 'wp_page_menu_args', 'wp_setmore_page_menu_args' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function wp_setmore_widgets_init() {
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'wp-setmore' ),
'id' => 'sidebar-right',
'before_widget' => '",
'before_title' => '
Posted on by%7$s', 'wp-setmore' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'wp-setmore' ), get_the_author() ) ),
esc_html( get_the_author() )
);
}
endif;
/**
* Adds custom classes to the array of body classes.
*/
if ( ! function_exists( 'wp_setmore_body_classes' ) ) :
function wp_setmore_body_classes( $classes ) {
// Adds a class of single-author to blogs with only 1 published author
if ( ! is_multi_author() ) {
$classes[] = 'single-author';
}
return $classes;
}
endif;
add_filter( 'body_class', 'wp_setmore_body_classes' );
/**
* Returns true if a blog has more than 1 category
*/
if ( ! function_exists( 'wp_setmore_categorized_blog' ) ) :
function wp_setmore_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
// Create an array of all the categories that are attached to posts
$all_the_cool_cats = get_categories( array(
'hide_empty' => 1,
) );
// Count the number of categories that are attached to the posts
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
if ( '1' != $all_the_cool_cats ) {
// This blog has more than 1 category so wp_setmore_categorized_blog should return true
return true;
} else {
// This blog has only 1 category so wp_setmore_categorized_blog should return false
return false;
}
}
endif;
/**
* Flush out the transients used in wp_setmore_categorized_blog
*/
if ( ! function_exists( 'wp_setmore_category_transient_flusher' ) ) :
function wp_setmore_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' );
}
endif;
add_action( 'edit_category', 'wp_setmore_category_transient_flusher' );
add_action( 'save_post', 'wp_setmore_category_transient_flusher' );
/**
* Remove WP default gallery styling
*/
add_filter( 'use_default_gallery_style', '__return_false' );
/**
* The Pagination Function
*/
if ( ! function_exists( 'wp_setmore_pagination' ) ) :
function wp_setmore_pagination() {
global $wp_query;
$big = 999999999;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
echo '
';
}
}
endif;
/**
* Add "Untitled" for posts without title,
*/
function wp_setmore_post_title($title) {
if ($title == '') {
return __('Untitled', 'wp-setmore');
} else {
return $title;
}
}
add_filter('the_title', 'wp_setmore_post_title');
/**
* Fix for W3C validation
*/
if ( ! function_exists( 'wp_setmore_w3c_valid_rel' ) ) :
function wp_setmore_w3c_valid_rel( $text ) {
$text = str_replace('rel="category tag"', 'rel="tag"', $text); return $text;
}
endif;
add_filter( 'the_category', 'wp_setmore_w3c_valid_rel' );
/*
* Modernizr functions
*/
if ( ! function_exists( 'wp_setmore_modernizr_addclass' ) ) :
function wp_setmore_modernizr_addclass($output) {
return $output . ' class="no-js"';
}
endif;
add_filter('language_attributes', 'wp_setmore_modernizr_addclass');
if ( ! function_exists( 'wp_setmore_modernizr_script' ) ) :
function wp_setmore_modernizr_script() {
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/library/js/modernizr-2.6.2.min.js', false, '2.6.2');
}
endif;
add_action('wp_enqueue_scripts', 'wp_setmore_modernizr_script');
/**
* Excerpt
*/
if ( ! function_exists( 'wp_setmore_excerpt' ) ) :
function wp_setmore_excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
endif;
/**
* Get Embed Video for post format video
*/
if ( ! function_exists('wp_setmore_featured_video') ) :
function wp_setmore_featured_video( &$content ) {
$url = trim( array_shift( explode( "\n", $content ) ) );
$w = get_option( 'embed_size_w' );
if ( !is_single() )
$url = str_replace( '448', $w, $url );
if ( ( 0 === strpos( $url, 'http://' ) ) || ( 0 === strpos( $url, 'https://' ) ) || ( 0 === strpos( $url, '//www' ) ) ) {
echo apply_filters( 'the_content', $url );
$content = trim( str_replace( $url, '', $content ) );
} else if ( preg_match ( '#^<(script|iframe|embed|object)#i', $url ) ) {
$h = get_option( 'embed_size_h' );
if ( !empty( $h ) ) {
if ( $w === $h ) $h = ceil( $w * 0.75 );
$url = preg_replace(
array( '#height="[0-9]+?"#i', '#height=[0-9]+?#i' ),
array( sprintf( 'height="%d"', $h ), sprintf( 'height=%d', $h ) ),
$url
);
}
echo $url;
$content = trim( str_replace( $url, '', $content ) );
}
}
endif;
/**
* Ignore Sticky
*/
function wp_setmore_ignore_sticky($query) {
$query->set( 'ignore_sticky_posts', true );
}
add_action('pre_get_posts', 'wp_setmore_ignore_sticky');
/**
* Enqueue scripts & styles
*/
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' );
/**
* Register the awesomeness and add IE7 support
*
* @global $wp_styles
* @global $is_IE
*/
function prefix_enqueue_awesome() {
global $wp_styles, $is_IE;
wp_enqueue_style( 'prefix-font-awesome', get_template_directory_uri() .'/library/font-awesome-4.4.0/css/font-awesome.min.css', array(), '4.3.0' );
if ( $is_IE ) {
wp_enqueue_style( 'prefix-font-awesome-ie', get_template_directory_uri() .'/library/font-awesome-4.4.0/css/font-awesome-ie7.min.css', array('prefix-font-awesome'), '3.2.0' );
// Add IE conditional tags for IE 7 and older
$wp_styles->add_data( 'prefix-font-awesome-ie', 'conditional', 'lte IE 7' );
}
}
if ( ! function_exists( 'wp_setmore_custom_scripts' ) ) :
function wp_setmore_custom_scripts() {
wp_register_script( 'imagesloaded', get_template_directory_uri() . '/library/js/imagesloaded.pkgd.min.js');
wp_register_script( 'cycle2', get_template_directory_uri() . '/library/js/jquery.cycle2.min.js' );
wp_register_script( 'cycle2_tile', get_template_directory_uri() . '/library/js/jquery.cycle2.tile.min.js' );
wp_register_script( 'cycle2_shuffle', get_template_directory_uri() . '/library/js/jquery.cycle2.shuffle.min.js' );
wp_register_script( 'cycle2_scrollvert', get_template_directory_uri() . '/library/js/jquery.cycle2.scrollVert.min.js' );
wp_enqueue_script( 'wp_setmore_custom_js', get_template_directory_uri() . '/library/js/scripts.js', array( 'jquery', 'imagesloaded', 'cycle2', 'cycle2_tile', 'cycle2_shuffle', 'cycle2_scrollvert', 'jquery-masonry' ), '1.0.0' );
wp_enqueue_style( 'wp_setmore_style', get_stylesheet_uri() );
}
endif;
add_action('wp_enqueue_scripts', 'wp_setmore_custom_scripts');
/**
*
* This script will prompt the users to install the plugin recommended to
* enable the "People" custom post type for this theme.
*
* @package TGM-Plugin-Activation
* @subpackage Example
* @version 2.3.6
* @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__ ) . '/library/class/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'wp_jurist_register_recommended_plugins' );
/**
* Register the recommended plugins for this theme.
*
* 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 wp_jurist_register_recommended_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 from the WordPress Plugin Repository
array(
'name' => 'Service Staff CPT', // The plugin name
'slug' => 'service-staff-cpt', // The plugin slug (typically the folder name)
'source' => get_stylesheet_directory() .'/library/service-staff-cpt.zip',
'required' => true,
'force_activation' => false,
'force_deactivation' => false
),
array(
'name' => 'Setmore Staff Booknow Button', // The plugin name
'slug' => 'setmore-staff-booknow-button', // The plugin slug (typically the folder name)
'source' => get_stylesheet_directory() .'/library/setmore-staff-booknow-button.zip',
'required' => true,
'force_activation' => false,
'force_deactivation' => false
),
);
// Change this to your theme text domain, used for internationalising strings
$theme_text_domain = 'wp-jurist';
/**
* 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 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_action( 'admin_menu', 'my_fonts' );
function my_fonts() {
add_theme_page( 'Fonts', 'Fonts', 'edit_theme_options', 'fonts', 'fonts' );
}
function fonts() {
?>