-
Notifications
You must be signed in to change notification settings - Fork 3
/
header.php
executable file
·109 lines (106 loc) · 3.49 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package fastshop
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?> <?php fastshop_html_tag_schema(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<script>
<?php
$site_url = untrailingslashit( site_url() );
$site_name = get_bloginfo( 'name' );
$shop_page_url = untrailingslashit( get_permalink( wc_get_page_id( 'shop' ) ) );
$pootlepress = '<a href="http://www.pootlepress.com">pootlepress</a>';
if ( get_option( 'show_on_front' ) == 'page' ) {
$home = get_post( get_option( 'page_on_front' ) );
$home = $home ? $home->post_name : $home;
$blog = get_post( get_option( 'page_for_posts' ) );
$blog = $blog ? $blog->post_name : $blog;
} else {
$home = '';
$blog = '';
}
ob_start();
wc_print_notices();
$notices = ob_get_contents();
ob_end_clean();
$fs_data = array(
'notices' => $notices,
'url' => FS_URL,
'home' => $home,
'blog' => $blog,
'siteUrl' => $site_url,
'siteName' => $site_name,
'tagline' => get_bloginfo( 'description' ),
'menu' => wp_nav_menu(
array(
'theme_location' => 'primary',
'container_class' => 'primary-navigation',
'echo' => false,
)
),
'routes' => array(
'product' =>
get_option( 'product_permalink_structure', '/product' ),
'cat' =>
get_option( 'category_base' ) ? get_option( 'category_base' ) : '/category',
'tag' =>
get_option( 'tag_base' ) ? get_option( 'tag_base' ) : '/tag',
'productCat' =>
get_option( 'woocommerce_product_category_slug', '/product-category' ),
'productTag' =>
get_option( 'woocommerce_product_tag_slug', '/product-tag' ),
'shop' =>
str_replace( $site_url, '', $shop_page_url ) ? str_replace( $site_url, '', $shop_page_url ) : 'does-not-exist-23kjbfrnfernf8437fnk78n5gf',
),
'wcStyle' => WC()->plugin_url() . '/assets/css/woocommerce.css',
'footer' => "© $site_name " . date( 'Y' ) . '<br>' . sprintf( __( '%1$s designed by %2$s.', 'fastshop' ), 'Fast shop', $pootlepress ),
'copy' => apply_filters( 'fastshop_copyright_text', "© $site_name " . date( 'Y' ) ),
);
ob_start();
get_sidebar();
$fs_data['sidebar'] = ob_get_contents();
ob_end_clean();
?>
fastshopData = <?php echo json_encode( $fs_data ) ?>;
fastshopData.adminbar = function ( id, postType ) {
var $ = jQuery,
$ab = $( '#wp-admin-bar-root-default' );
postType = postType ? postType.replace( '-', ' ' ) : 'Post';
postType = postType.charAt(0).toUpperCase() + postType.slice(1);
if ( $ab.length ) {
$( '#wp-admin-bar-edit' ).remove();
if ( id ) {
var $a = $( '<a/>' ),
$li = $( '<li/>' );
$a
.addClass( 'ab-item' )
.attr( 'href', '<?php echo admin_url() ?>/post.php?post=' + id + '&action=edit' )
.html( 'Edit ' + postType );
$li
.attr( 'id', 'wp-admin-bar-edit' )
.append( $a );
$ab.append( $li );
}
}
};
fastshopPreloaded = null;
System.config( {
transpiler : 'typescript',
typescriptOptions : { emitDecoratorMetadata : true },
packages : { 'app' : { defaultExtension : 'js' } }
} );
System.import( '<?php echo FS_URL ?>/ng/app.ts' )
.then( null, console.error.bind( console ) );
</script>