200,
'width' => 600,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
// Title tag
add_theme_support( 'title-tag' );
// Add nav menu
register_nav_menu( 'primary-menu', __( 'Primary Menu', 'griddist' ) );
register_nav_menu( 'mobile-menu', __( 'Mobile Menu', 'griddist' ) );
register_nav_menu( 'social', __( 'Social Menu', 'griddist' ) );
// HTML5 semantic markup
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'caption' ) );
// Make the theme translation ready
load_theme_textdomain( 'griddist', get_template_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'griddist_setup' );
endif;
/* ---------------------------------------------------------------------------------------------
ENQUEUE STYLES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_load_style' ) ) :
function griddist_load_style() {
if ( ! is_admin() ) :
wp_register_style( 'griddist-fontawesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.css' );
$dependencies = array( 'griddist-fontawesome' );
wp_enqueue_style( 'griddist-style', get_template_directory_uri() . '/style.css', $dependencies, wp_get_theme()->get( 'Version' ) );
endif;
}
add_action( 'wp_enqueue_scripts', 'griddist_load_style' );
endif;
/* ---------------------------------------------------------------------------------------------
ENQUEUE SCRIPTS
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_enqueue_scripts' ) ) :
function griddist_enqueue_scripts() {
wp_enqueue_script( 'griddist_construct', get_template_directory_uri() . '/assets/js/construct.js', array( 'jquery', 'imagesloaded', 'masonry' ), wp_get_theme()->get( 'Version' ), true );
if ( ( ! is_admin() ) && is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
$ajax_url = admin_url( 'admin-ajax.php' );
// AJAX Load More
wp_localize_script( 'griddist_construct', 'griddist_ajax_load_more', array(
'ajaxurl' => esc_url( $ajax_url ),
) );
}
add_action( 'wp_enqueue_scripts', 'griddist_enqueue_scripts' );
endif;
/* ---------------------------------------------------------------------------------------------
EXCERPTS
--------------------------------------------------------------------------------------------- */
function griddist_excerpt_more( $more ) {
if ( is_admin() ) {
return $more;
}
return '...';
}
add_filter( 'excerpt_more', 'griddist_excerpt_more' );
function griddist_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'griddist_custom_excerpt_length', 999 );
/* ---------------------------------------------------------------------------------------------
GET FONTS
--------------------------------------------------------------------------------------------- */
function griddist_load_google_fonts() {
wp_enqueue_style( 'griddist-google-fonts', 'http://fonts.googleapis.com/css?family=Lato:400,700,900|Merriweather:700i' );
}
add_action( 'wp_enqueue_scripts', 'griddist_load_google_fonts' );
/* ---------------------------------------------------------------------------------------------
POST CLASSES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_post_classes' ) ) :
function griddist_post_classes( $classes ) {
global $post;
// Class indicating presence/lack of post thumbnail
$classes[] = ( has_post_thumbnail() ? 'has-thumbnail' : 'missing-thumbnail' );
return $classes;
}
add_action( 'post_class', 'griddist_post_classes' );
endif;
/* ---------------------------------------------------------------------------------------------
BODY CLASSES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_body_classes' ) ) :
function griddist_body_classes( $classes ) {
global $post;
// Determine type of infinite scroll
$pagination_type = get_theme_mod( 'griddist_pagination_type' ) ? get_theme_mod( 'griddist_pagination_type' ) : 'button';
switch ( $pagination_type ) {
case 'button' :
$classes[] = 'pagination-type-button';
break;
case 'scroll' :
$classes[] = 'pagination-type-scroll';
break;
case 'links' :
$classes[] = 'pagination-type-links';
break;
}
// Check for post thumbnail
if ( is_singular() && has_post_thumbnail() ) {
$classes[] = 'has-post-thumbnail';
} elseif ( is_singular() ) {
$classes[] = 'missing-post-thumbnail';
}
// Check whether we're in the customizer preview
if ( is_customize_preview() ) {
$classes[] = 'customizer-preview';
}
// Slim page template class names (class = name - file suffix)
if ( is_page_template() ) {
$classes[] = preg_replace( '/\\.[^.\\s]{3,4}$/', '', get_page_template_slug( $post->ID ) );
}
return $classes;
}
add_action( 'body_class', 'griddist_body_classes' );
endif;
/* ---------------------------------------------------------------------------------------------
ADD HTML CLASS IF THERE'S JAVASCRIPT
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_has_js' ) ) :
function griddist_has_js() {
?>
-
-
-
-
-
-
';
echo '' . __( 'Edit', 'griddist' ) . '';
echo '';
}
?>
__( 'Sidebar', 'griddist' ),
'id' => 'sidebar',
'description' => __( 'Widgets in this area will be shown below the main menu.', 'griddist' ),
'before_title' => '',
'before_widget' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #1', 'griddist' ),
'id' => 'footer-one',
'description' => __( 'Widgets in this area will be shown in the first footer column.', 'griddist' ),
'before_title' => '',
'before_widget' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #2', 'griddist' ),
'id' => 'footer-two',
'description' => __( 'Widgets in this area will be shown in the second footer column.', 'griddist' ),
'before_title' => '',
'before_widget' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #3', 'griddist' ),
'id' => 'footer-three',
'description' => __( 'Widgets in this area will be shown in the third footer column.', 'griddist' ),
'before_title' => '',
'before_widget' => '',
) );
}
add_action( 'widgets_init', 'griddist_widget_areas' );
endif;
/* ---------------------------------------------------------------------------------------------
REMOVE ARCHIVE PREFIXES
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_remove_archive_title_prefix' ) ) :
function griddist_remove_archive_title_prefix( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '' . get_the_author() . '';
} elseif ( is_year() ) {
$title = get_the_date( 'Y' );
} elseif ( is_month() ) {
$title = get_the_date( 'F Y' );
} elseif ( is_day() ) {
$title = get_the_date( get_option( 'date_format' ) );
} elseif ( is_tax( 'post_format' ) ) {
if ( is_tax( 'post_format', 'post-format-aside' ) ) {
$title = _x( 'Asides', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
$title = _x( 'Galleries', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
$title = _x( 'Images', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
$title = _x( 'Videos', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
$title = _x( 'Quotes', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
$title = _x( 'Links', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
$title = _x( 'Statuses', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
$title = _x( 'Audio', 'post format archive title', 'griddist' );
} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
$title = _x( 'Chats', 'post format archive title', 'griddist' );
}
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
} elseif ( is_search() ) {
$title = '“' . get_search_query() . '”';
} else {
$title = __( 'Archives', 'griddist' );
} // End if().
return $title;
}
add_filter( 'get_the_archive_title', 'griddist_remove_archive_title_prefix' );
endif;
/* ---------------------------------------------------------------------------------------------
GET ARCHIVE PREFIX
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_get_archive_title_prefix' ) ) :
function griddist_get_archive_title_prefix() {
if ( is_category() ) {
$title_prefix = __( 'Category', 'griddist' );
} elseif ( is_tag() ) {
$title_prefix = __( 'Tag', 'griddist' );
} elseif ( is_author() ) {
$title_prefix = __( 'Author', 'griddist' );
} elseif ( is_year() ) {
$title_prefix = __( 'Year', 'griddist' );
} elseif ( is_month() ) {
$title_prefix = __( 'Month', 'griddist' );
} elseif ( is_day() ) {
$title_prefix = __( 'Day', 'griddist' );
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
$title_prefix = $tax->labels->singular_name;
} elseif ( is_search() ) {
$title_prefix = __( 'Search Results', 'griddist' );
} else {
$title_prefix = __( 'Archives', 'griddist' );
}
return $title_prefix;
}
endif;
/* ---------------------------------------------------------------------------------------------
GET FALLBACK IMAGE
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_get_fallback_image_url' ) ) :
function griddist_get_fallback_image_url() {
$disable_fallback_image = get_theme_mod( 'griddist_disable_fallback_image' );
if ( $disable_fallback_image ) {
return '';
}
$fallback_image_id = get_theme_mod( 'griddist_fallback_image' );
if ( $fallback_image_id ) {
$fallback_image = wp_get_attachment_image_src( $fallback_image_id, 'full' );
}
$fallback_image_url = isset( $fallback_image ) ? esc_url( $fallback_image[0] ) : get_template_directory_uri() . '/assets/images/default-fallback-image.png';
return $fallback_image_url;
}
endif;
/* ---------------------------------------------------------------------------------------------
GET THE IMAGE SIZE OF PREVIEWS
--------------------------------------------------------------------------------------------- */
if ( ! function_exists( 'griddist_get_preview_image_size' ) ) :
function griddist_get_preview_image_size() {
// Check if low-resolution images are activated in the customizer
$low_res_images = get_theme_mod( 'griddist_activate_low_resolution_images' );
// If they are, we're using the low resolution image size
if ( $low_res_images ) {
return 'griddist_preview_image_low_resolution';
// If not, we're using the high resolution image size
} else {
return 'griddist_preview_image_high_resolution';
}
}
endif;
if ( ! function_exists( 'griddist_add_gutenberg_features' ) ) :
function griddist_add_gutenberg_features() {
/* Gutenberg Feature Opt-Ins --------------------------------------- */
add_theme_support( 'align-wide' );
/* Gutenberg Palette --------------------------------------- */
add_theme_support( 'editor-color-palette', array(
array(
'name' => _x( 'Black', 'Name of the black color in the Gutenberg palette', 'griddist' ),
'slug' => 'black',
'color' => '#232D37',
),
array(
'name' => _x( 'Darkest gray', 'Name of the darkest gray color in the Gutenberg palette', 'griddist' ),
'slug' => 'darkest-gray',
'color' => '#4B555F',
),
array(
'name' => _x( 'Darker Gray', 'Name of the darker gray color in the Gutenberg palette', 'griddist' ),
'slug' => 'darker-gray',
'color' => '#69737D',
),
array(
'name' => _x( 'Gray', 'Name of the gray color in the Gutenberg palette', 'griddist' ),
'slug' => 'gray',
'color' => '#9BA5AF',
),
array(
'name' => _x( 'Light gray', 'Name of the light gray color in the Gutenberg palette', 'griddist' ),
'slug' => 'light-gray',
'color' => '#DCDFE2',
),
array(
'name' => _x( 'Lightest gray', 'Name of the lightest gray color in the Gutenberg palette', 'griddist' ),
'slug' => 'lightest-gray',
'color' => '#E6E9EC',
),
array(
'name' => _x( 'White', 'Name of the white color in the Gutenberg palette', 'griddist' ),
'slug' => 'white',
'color' => '#FFF',
),
) );
/* Gutenberg Font Sizes --------------------------------------- */
add_theme_support( 'editor-font-sizes', array(
array(
'name' => _x( 'Small', 'Name of the small font size in Gutenberg', 'griddist' ),
'shortName' => _x( 'S', 'Short name of the small font size in the Gutenberg editor.', 'griddist' ),
'size' => 16,
'slug' => 'small',
),
array(
'name' => _x( 'Regular', 'Name of the regular font size in Gutenberg', 'griddist' ),
'shortName' => _x( 'M', 'Short name of the regular font size in the Gutenberg editor.', 'griddist' ),
'size' => 19,
'slug' => 'regular',
),
array(
'name' => _x( 'Large', 'Name of the large font size in Gutenberg', 'griddist' ),
'shortName' => _x( 'L', 'Short name of the large font size in the Gutenberg editor.', 'griddist' ),
'size' => 24,
'slug' => 'large',
),
array(
'name' => _x( 'Larger', 'Name of the larger font size in Gutenberg', 'griddist' ),
'shortName' => _x( 'XL', 'Short name of the larger font size in the Gutenberg editor.', 'griddist' ),
'size' => 32,
'slug' => 'larger',
),
) );
}
add_action( 'after_setup_theme', 'griddist_add_gutenberg_features' );
endif;
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Custom Header
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Extra PHP.
*/
require get_template_directory() . '/inc/extra.php';
/**
* Justintadlock customizer button https://github.com/justintadlock/trt-customizer-pro
*/
require_once( trailingslashit( get_template_directory() ) . 'justinadlock-customizer-button/class-customize.php' );
/**
* Compare page CSS
*/
function griddist_comparepage_css($hook) {
if ( 'appearance_page_griddist-info' != $hook ) {
return;
}
wp_enqueue_style( 'griddist-custom-style', get_template_directory_uri() . '/css/compare.css' );
}
add_action( 'admin_enqueue_scripts', 'griddist_comparepage_css' );
/**
* Compare page content
*/
add_action('admin_menu', 'griddist_themepage');
function griddist_themepage(){
$theme_info = add_theme_page( __('Griddist Info','griddist'), __('Griddist Info','griddist'), 'manage_options', 'griddist-info.php', 'griddist_info_page' );
}
function griddist_info_page() {
$user = wp_get_current_user();
?>
|
|
|
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |
|
" /> |
" /> |