Browse Source

Updated functions.php

main
Kenneth John Odle 3 years ago
parent
commit
78d522b6e1
  1. 72
      functions.php

72
functions.php

@ -2,10 +2,10 @@
/**
* Atticus Finch functions and definitions
*
* @package Atticus Finch
* @package Portage
*/
if ( ! function_exists( 'atticus_finch_setup' ) ) :
if ( ! function_exists( 'portage_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
@ -13,14 +13,14 @@ if ( ! function_exists( 'atticus_finch_setup' ) ) :
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function atticus_finch_setup() {
function portage_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Atticus Finch, use a find and replace
* to change 'atticus-finch' to the name of your theme in all the template files
* to change 'portage' to the name of your theme in all the template files
*/
load_theme_textdomain( 'atticus-finch', get_template_directory() . '/lang' );
load_theme_textdomain( 'portage', get_template_directory() . '/lang' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
@ -42,9 +42,9 @@ function atticus_finch_setup() {
// This theme uses wp_nav_menu() in three locations.
register_nav_menus( array(
'top-menu' => esc_html__( 'Top Menu', 'atticus-finch' ),
'primary-menu' => esc_html__( 'Primary Menu', 'atticus-finch' ),
'footer-menu' => esc_html__( 'Footer Menu', 'atticus-finch' ),
'top-menu' => esc_html__( 'Top Menu', 'portage' ),
'primary-menu' => esc_html__( 'Primary Menu', 'portage' ),
'footer-menu' => esc_html__( 'Footer Menu', 'portage' ),
) );
/*
@ -76,13 +76,13 @@ function atticus_finch_setup() {
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'atticus_finch_custom_background_args', array(
add_theme_support( 'custom-background', apply_filters( 'portage_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // atticus_finch_setup
add_action( 'after_setup_theme', 'atticus_finch_setup' );
endif; // portage_setup
add_action( 'after_setup_theme', 'portage_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
@ -91,19 +91,19 @@ add_action( 'after_setup_theme', 'atticus_finch_setup' );
*
* @global int $content_width
*/
function atticus_finch_content_width() {
$GLOBALS['content_width'] = apply_filters( 'atticus_finch_content_width', 620 );
function portage_content_width() {
$GLOBALS['content_width'] = apply_filters( 'portage_content_width', 620 );
}
add_action( 'after_setup_theme', 'atticus_finch_content_width', 0 );
add_action( 'after_setup_theme', 'portage_content_width', 0 );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function atticus_finch_widgets_init() {
function portage_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'atticus-finch' ),
'name' => esc_html__( 'Sidebar', 'portage' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
@ -112,58 +112,58 @@ function atticus_finch_widgets_init() {
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'atticus_finch_widgets_init' );
add_action( 'widgets_init', 'portage_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function atticus_finch_scripts() {
wp_enqueue_style( 'atticus-finch-googlefont', 'https://fonts.googleapis.com/css?family=IM+Fell+English:400,400italic', 'atticus-finch-style', wp_get_theme() -> get( 'Version' ), 'all' );
function portage_scripts() {
wp_enqueue_style( 'portage-googlefont', 'https://fonts.googleapis.com/css?family=IM+Fell+English:400,400italic', 'portage-style', wp_get_theme() -> get( 'Version' ), 'all' );
if ( !wp_style_is( 'font-awesome.min.css', 'enqueued' ) ) {
wp_enqueue_style( 'atticus-finch-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', 'atticus-finch-style', wp_get_theme() -> get( 'Version' ), 'all' );
wp_enqueue_style( 'portage-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', 'portage-style', wp_get_theme() -> get( 'Version' ), 'all' );
}
wp_enqueue_style( 'atticus-finch-style', get_stylesheet_uri() );
wp_enqueue_style( 'portage-style', get_stylesheet_uri() );
wp_enqueue_style( 'atticus-finch-menus', get_template_directory_uri() . '/styles/menus.css', array( 'atticus-finch-style' ), wp_get_theme() -> get( 'Version' ) );
wp_enqueue_style( 'portage-menus', get_template_directory_uri() . '/styles/menus.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ) );
wp_enqueue_style( 'atticus-finch-mobile', get_template_directory_uri() . '/styles/mobile.css', array( 'atticus-finch-style' ), wp_get_theme() -> get( 'Version' ), 'screen and (max-width: '. get_theme_mod( 'atticus_finch_mobile_breakpoint' ) . 'px)' );
wp_enqueue_style( 'portage-mobile', get_template_directory_uri() . '/styles/mobile.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ), 'screen and (max-width: '. get_theme_mod( 'portage_mobile_breakpoint' ) . 'px)' );
wp_enqueue_style( 'atticus-finch-print', get_template_directory_uri() . '/styles/print.css', array( 'atticus-finch-style' ), wp_get_theme() -> get( 'Version' ), 'print' );
wp_enqueue_style( 'portage-print', get_template_directory_uri() . '/styles/print.css', array( 'portage-style' ), wp_get_theme() -> get( 'Version' ), 'print' );
wp_enqueue_script( 'atticus-finch-menumaker', get_template_directory_uri() . '/js/menumaker.js', array( 'jquery' ), wp_get_theme() -> get( 'Version' ), true );
wp_enqueue_script( 'portage-menumaker', get_template_directory_uri() . '/js/menumaker.js', array( 'jquery' ), wp_get_theme() -> get( 'Version' ), true );
wp_enqueue_script( 'atticus-finch-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), wp_get_theme() -> get( 'Version' ), true );
wp_enqueue_script( 'portage-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), wp_get_theme() -> get( 'Version' ), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'atticus_finch_scripts' );
add_action( 'wp_enqueue_scripts', 'portage_scripts' );
/**
* Enable live changes in the customizer
*/
function atticus_finch_customizer_script() {
wp_enqueue_script( 'atticus-finch-theme-customizer', get_template_directory_uri() . '/js/customizer.js', array(), wp_get_theme() -> get( 'Version' ), true );
function portage_customizer_script() {
wp_enqueue_script( 'portage-theme-customizer', get_template_directory_uri() . '/js/customizer.js', array(), wp_get_theme() -> get( 'Version' ), true );
}
add_action( 'customize_preview_init', 'atticus_finch_customizer_script' );
add_action( 'customize_preview_init', 'portage_customizer_script' );
// Change "read more" link on excerpts
// codex.wordpress.org/Function_Reference/the_excerpt
function atticus_finch_excerpt_more( $more ) {
$text = get_theme_mod( 'atticus_finch_readmore', '&hellip;read more&hellip;' );
function portage_excerpt_more( $more ) {
$text = get_theme_mod( 'portage_readmore', '&hellip;read more&hellip;' );
return ' <a class="excerpt-link" href="' . get_permalink( get_the_ID() ) . '">' . $text . '</a>';
}
add_filter( 'excerpt_more', 'atticus_finch_excerpt_more' );
add_filter( 'excerpt_more', 'portage_excerpt_more' );
// Add descriptions to main menu
// http://www.wpbeginner.com/wp-themes/how-to-add-menu-descriptions-in-your-wordpress-themes/
/*
class Atticus_Finch_Menu_With_Description extends Walker_Nav_Menu {
class portage_Menu_With_Description extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth=0, $args = array(), $id=0) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
@ -227,7 +227,7 @@ require get_template_directory() . '/functions/mobile-menus.php';
// Include our update script to update from private repo
require 'update/puc.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'http://api.kjodle.net/?action=get_metadata&slug=atticus-finch',
'http://api.kjodle.net/?action=get_metadata&slug=portage',
__FILE__,
'atticus-finch'
'portage'
);
Loading…
Cancel
Save