%PDF- %PDF-
Direktori : /home/graphicd/public_html/demo/riverwalkpoa/wp-content/themes/sandwich/ |
Current File : /home/graphicd/public_html/demo/riverwalkpoa/wp-content/themes/sandwich/functions.php |
<?php /** * Sandwich functions and definitions */ require 'SandwichTheme-update-checker/plugin-update-checker.php'; $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( 'https://localsitesgo.s3.amazonaws.com/Update-Checker-SandwichTheme.json', __FILE__, 'Sandwich Theme' ); if ( ! function_exists( 'sandwich_setup' ) ) : function sandwich_setup() { load_theme_textdomain( 'sandwich', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary_menu' => esc_html__( 'Primary Menu', 'sandwich' ), 'secondary_menu' => esc_html__( 'Secondary Menu', 'sandwich' ), 'mobile_menu' => esc_html__( 'Mobile Menu', 'sandwich' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'sandwich_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); } endif; add_action( 'after_setup_theme', 'sandwich_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. */ function sandwich_content_width() { $GLOBALS['content_width'] = apply_filters( 'sandwich_content_width', 640 ); } add_action( 'after_setup_theme', 'sandwich_content_width', 0 ); /** * Register widget area. */ function sandwich_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Primary Sidebar', 'sandwich' ), 'id' => 'primary_sidebar', 'description' => esc_html__( 'Blog Post Sidebar', 'sandwich' ), 'before_widget' => '<section id="primary_sidebar" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title" id="primary_sidebar_heading">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Before Footer', 'sandwich' ), 'id' => 'before_footer', 'description' => esc_html__( 'Add Before Footer', 'sandwich' ), 'before_widget' => '<section id="before_footer_sidebar" class="widget %2$s before_footer_single_item">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title" id="before_footer_sidebar_heading">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'sandwich_widgets_init' ); /** * Enqueue scripts and styles. */ function sandwich_scripts() { wp_enqueue_style('bootstrap',get_template_directory_uri().'/css/bootstrap.min.css',null,'3.3.7','all'); wp_enqueue_style('google-font-one','//fonts.googleapis.com/css?family=Roboto:300,400,500,700'); wp_enqueue_style('google-font-two','//fonts.googleapis.com/css?family=Great+Vibes|Karla:400,700'); wp_enqueue_style('font-awesome',get_template_directory_uri().'/css/font-awesome.min.css',null,'4.3.7','all'); wp_enqueue_style( 'fa5', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), '5.13.0', 'all' ); wp_enqueue_style( 'fa5-v4-shims', 'https://use.fontawesome.com/releases/v5.13.0/css/v4-shims.css', array(), '5.13.0', 'all' ); wp_enqueue_style('slicknav',get_template_directory_uri().'/css/slicknav.min.css',null,'4.3.7','all'); wp_enqueue_style( 'sandwich-style', get_stylesheet_uri() ); wp_enqueue_style('sandwich-main',get_template_directory_uri().'/css/sandwich.css',null,time(),'all'); wp_enqueue_style('customizer-change',get_template_directory_uri().'/css/customizer-change.css',null,time(),'all'); wp_enqueue_style('customizer-style',get_template_directory_uri().'/css/customizer-style.css',null,time(),'all'); wp_enqueue_script( 'slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', array('jquery'), '20151215', true ); wp_enqueue_script( 'sandwich-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'sandwich-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); wp_enqueue_script( 'sandwich', get_template_directory_uri() . '/js/sandwich.js', array('jquery'), time(), true ); get_template_part('/inc/customizer-style'); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'sandwich_scripts' ); /* * Replaces the excerpt "Read More" text by a link * */ function sandwich_new_excerpt_more($more) { global $post; return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Continue Reading...</a>'; } add_filter('excerpt_more', 'sandwich_new_excerpt_more'); /* * Admin CSS * */ function sandwich_admin_assets($hook){ wp_enqueue_style('admin',get_template_directory_uri().'/css/admin.css'); } add_action('admin_enqueue_scripts','sandwich_admin_assets'); /* * Sticky Header CSS Coding * */ function sandwich_sticky_header(){ get_template_part('/other-layouts/sticky-header-layouts'); } add_action('wp_head','sandwich_sticky_header'); /* * Before Footer Width Control * */ function sandwich_before_footer(){ get_template_part('/other-layouts/before-footer'); } add_action('wp_head','sandwich_before_footer'); // Header Background Image function sandwich_custom_header(){ if (has_custom_header()): ?> <style> header#masthead{ background-image: url('<?php echo get_header_image(); ?>'); -webkit-background-size: cover; background-size: cover; background-position: center center; background-repeat: no-repeat; } </style> <?php endif; if (get_theme_mod('sandwich_primary_siebar_icon_display','true')): ?> <style> section#primary_sidebar ul li:before { position: absolute; top: 0; left: -15px; content: '\f105'; font-family: fontAwesome; } </style> <?php endif; if (get_theme_mod('sandwich_primary_siebar_bullet_icon_display',true)): ?> <style> section#primary_sidebar ul li{ list-style: none; } </style> <?php endif; } add_action('wp_head','sandwich_custom_header'); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Kirki Customizer * */ require get_template_directory().'/lib/kirki/kirki.php'; require get_template_directory().'/inc/kirki-customizer.php'; /** * Customizer default control and section remove */ function sandwich_customizer_control_remove($wp_customize ){ $wp_customize->remove_section( 'colors' ); $wp_customize->get_section( 'static_front_page' )->priority = 21; $wp_customize->get_section( 'background_image' )->priority = 22; } add_action('customize_register','sandwich_customizer_control_remove'); /* * Menu Panel Position * */ add_action( 'customize_register', function( \WP_Customize_Manager $wp_customize ) { $sandwich_menus_panel = $wp_customize->get_panel( 'nav_menus'); if( $sandwich_menus_panel instanceof \WP_Customize_Nav_Menus_Panel ) { $sandwich_menus_panel ->priority = 28; } }, 12 ); /* * Paginate Link for posts * */ function pagainate_link_function(){ global $wp_query; $sandwich_paginate = paginate_links(array( 'current'=>max(1,get_query_var('paged')), 'total'=>$wp_query->max_num_pages, 'type'=>'list', 'echo'=> false, 'prev_text'=> "<i class='fa fa-angle-left'></i>", 'next_text'=> "<i class='fa fa-angle-right'></i>", )); $sandwich_paginate = str_replace("<ul class='page-numbers'>","<ul class='page-numbers post-pagination'>",$sandwich_paginate); echo $sandwich_paginate; } /* * Custom Header Custom Post type * */ function sandwich_custom_header_post_type() { /** * Post Type: Custom Header. */ $labels = array( "name" => __( "Custom Header", "sandwich" ), "singular_name" => __( "Custom Header", "sandwich" ), "menu_name" => __( "Custom Header", "sandwich" ), "add_new" => __( "New Header", "sandwich" ), "add_new_item" => __( "Add New Header", "sandwich" ), "edit_item" => __( "Edit Header", "sandwich" ), "new_item" => __( "New Header", "sandwich" ), ); $args = array( "label" => __( "Custom Header", "sandwich" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "delete_with_user" => false, "show_in_rest" => true, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "has_archive" => false, "show_in_menu" => true, "show_in_nav_menus" => true, "exclude_from_search" => true, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "rewrite" => array( "slug" => "custom_header", "with_front" => false ), "query_var" => true, "supports" => array( "title", "editor" ), ); register_post_type( "custom_header", $args ); } add_action( 'init', 'sandwich_custom_header_post_type' );