add woocommerce support declaration

This commit is contained in:
Holger Könemann 2015-09-09 10:58:25 +02:00
parent 76b57bbfa2
commit 55075824cc
9 changed files with 44 additions and 77 deletions

View File

@ -57,3 +57,8 @@ require get_template_directory() . '/inc/jetpack.php';
* Load custom WordPress nav walker.
*/
require get_template_directory() . '/inc/bootstrap-wp-navwalker.php';
/**
* Load WooCommerce functions.
*/
require get_template_directory() . '/inc/woocommerce.php';

View File

@ -13,6 +13,7 @@
* Author: Edward McIntyre - @twittem
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* @package understrap
*/
//exit if accessed directly
if(!defined('ABSPATH')) exit;

View File

@ -4,13 +4,13 @@
* http://codex.wordpress.org/Custom_Headers
*
* You can add an optional custom header image to header.php like so ...
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="">
</a>
<?php endif; // End header image check. ?>
*
* <?php if ( get_header_image() ) : ?>
* <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
* <img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="">
* </a>
* <?php endif; // End header image check. ?>
*
*
* @package understrap
*/

View File

@ -1,4 +1,9 @@
<?php
/**
* understrap enqueue scripts
*
* @package understrap
*/
function understrap_scripts() {
wp_enqueue_style( 'understrap-theme', get_stylesheet_directory_uri() . '/css/theme.min.css', array(), '0.2.8', false );

View File

@ -1,4 +1,9 @@
<?php
/**
* understrap - load the scripts
*
* @package understrap
*/
function understrap_scripts() {
wp_enqueue_style( 'understrap-theme', get_stylesheet_directory_uri() . '/css/theme.css', array(), '0.1', false );

View File

@ -1,6 +1,7 @@
<?php
/**
* Set the content width based on the theme's design and stylesheet.
* @package understrap
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
@ -78,12 +79,12 @@ endif; // understrap_setup
add_action( 'after_setup_theme', 'understrap_setup' );
/**
/* Removes Adminbar - Comment out if you want see the bar.
* Removes Adminbar - Comment out if you want see the bar.
*/
add_filter('show_admin_bar', '__return_false');
/**
/* Adding the Read more link to excerpts
* Adding the Read more link to excerpts
*/
/*function new_excerpt_more( $more ) {
return ' <p><a class="read-more btn btn-default" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'understrap') . '</a></p>';

View File

@ -1,4 +1,10 @@
<?php
/**
* Declaring widgets
*
*
* @package understrap
*/
function understrap_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'understrap' ),

12
inc/woocommerce.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/**
* Add WooCommerce support
*
*
* @package understrap
*/
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}

View File

@ -1,68 +0,0 @@
<?php
/*
WPUpdates Theme Updater Class
http://wp-updates.com
v2.0
Example Usage:
require_once('wp-updates-theme.php');
new WPUpdatesThemeUpdater_1114( 'http://wp-updates.com/api/2/theme', basename(get_template_directory()) );
*/
if( !class_exists('WPUpdatesThemeUpdater_1114') ) {
class WPUpdatesThemeUpdater_1114 {
var $api_url;
var $theme_id = 1114;
var $theme_slug;
var $license_key;
function __construct( $api_url, $theme_slug, $license_key = null ) {
$this->api_url = $api_url;
$this->theme_slug = $theme_slug;
$this->license_key = $license_key;
add_filter( 'pre_set_site_transient_update_themes', array(&$this, 'check_for_update') );
// This is for testing only!
//set_site_transient('update_themes', null);
}
function check_for_update( $transient ) {
if (empty($transient->checked)) return $transient;
$request_args = array(
'id' => $this->theme_id,
'slug' => $this->theme_slug,
'version' => $transient->checked[$this->theme_slug]
);
if ($this->license_key) $request_args['license'] = $this->license_key;
$request_string = $this->prepare_request( 'theme_update', $request_args );
$raw_response = wp_remote_post( $this->api_url, $request_string );
$response = null;
if( !is_wp_error($raw_response) && ($raw_response['response']['code'] == 200) )
$response = unserialize($raw_response['body']);
if( !empty($response) ) // Feed the update data into WP updater
$transient->response[$this->theme_slug] = $response;
return $transient;
}
function prepare_request( $action, $args ) {
global $wp_version;
return array(
'body' => array(
'action' => $action,
'request' => serialize($args),
'api-key' => md5(home_url())
),
'user-agent' => 'WordPress/'. $wp_version .'; '. home_url()
);
}
}
}