-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
executable file
·100 lines (75 loc) · 2.99 KB
/
functions.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
<?php
/**
* Author: Ole Fredrik Lie
* URL: http://olefredrik.com
*
* FoundationPress functions and definitions
*
* Set up the theme and provides some helper functions, which are used in the
* theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality.
*
* @link https://codex.wordpress.org/Theme_Development
* @package FoundationPress
* @since FoundationPress 1.0.0
*/
/** Various clean up functions */
require_once( 'library/cleanup.php' );
/** Required for Foundation to work properly */
require_once( 'library/foundation.php' );
/** Register all navigation menus */
require_once( 'library/navigation.php' );
/** Add menu walkers for top-bar and off-canvas */
require_once( 'library/menu-walkers.php' );
/** Create widget areas in sidebar and footer */
require_once( 'library/widget-areas.php' );
/** Return entry meta information for posts */
require_once( 'library/entry-meta.php' );
/** Enqueue scripts */
require_once( 'library/enqueue-scripts.php' );
/** Add theme support */
require_once( 'library/theme-support.php' );
/** Add Nav Options to Customer */
require_once( 'library/custom-nav.php' );
/** Change WP's sticky post class */
require_once( 'library/sticky-posts.php' );
/** Configure responsive image sizes */
require_once( 'library/responsive-images.php' );
/** Custom Post Types */
require_once( 'library/bs-custom-post-types.php' );
/** Custom Functions - various shortcodes and other custom functions*/
require_once( 'library/bs-custom-functions.php' );
/** Customizer Additions */
require_once( 'library/bs-customizer-additions.php' );
/** Required and Recommended Plugins */
require_once( 'library/class-tgm-plugin-activation.php' );
require_once( 'library/bs-plugin-activation.php' );
/** If your site requires protocol relative url's for theme assets, uncomment the line below */
// require_once( 'library/protocol-relative-theme-assets.php' );
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if ( is_archive() && (is_category() || is_tag()) && empty( $query->query_vars['suppress_filters'] ) ) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
$post_type = array('post','portfolio');
$query->set('post_type',$post_type);
return $query;
}
}
function acf_set_featured_image( $value, $post_id, $field ){
if($value != ''){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta($post_id, '_thumbnail_id', $value);
}
return $value;
}
// acf/update_value/name={$field_name} - filter for a specific field based on it's name
//$thumb = get_field('bs_portfolio_thumbnail');
add_filter('acf/update_value/name=bs_portfolio_thumbnail', 'acf_set_featured_image', 10, 3);
add_filter( 'script_loader_tag', function ( $tag, $handle ) {
if ( 'events-manager' !== $handle )
return $tag;
return str_replace( ' src', ' async src', $tag );
}, 10, 2 );