-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·104 lines (83 loc) · 3.38 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
101
102
103
104
<?php
require_once 'library/enqueue-scripts.php';
// ======= Register Advanced Custom Fields (ACF) =======
function uthsc_get_acf($field_name, $post_id, $before, $after)
{
return get_field($field_name, $post_id) ? $before . get_field($field_name, $post_id) . $after : '';
}
// =(end)= Register Advanced Custom Fields (ACF) ========
// ======= offices function =======
function cptui_register_my_cpts_offices() {
/**
* Post Type: Offices.
*/
$labels = array(
"name" => __( "Offices", "emerald-wp-child" ),
"singular_name" => __( "Office", "emerald-wp-child" ),
"all_items" => __( "Offices", "emerald-wp-child" ),
);
$args = array(
"label" => __( "Offices", "emerald-wp-child" ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => false,
"rest_base" => "",
"has_archive" => "offices",
"show_in_menu" => true,
"exclude_from_search" => false,
"capability_type" => "",
"map_meta_cap" => true,
"hierarchical" => true,
"rewrite" => array( "slug" => "offices", "with_front" => true ),
"query_var" => true,
"menu_icon" => "http://emerald-wp-care.multisite.uthsc.edu/wp-content/uploads/sites/25/2017/08/offices.png",
"supports" => array( "title", "editor", "thumbnail" ),
);
register_post_type( "offices", $args );
}
add_action( 'init', 'cptui_register_my_cpts_offices' );
// =(end)= offices function =======
// ======= offices shortcode function =======
function offices_shortcode_function($atts)
{
$offices_query = null;
$output = '';
$output .= '<ul class="small-block-grid-2 medium-block-grid-4 large-block-grid-6 fmc-gallery-with-captions"> test html';
$args = [
'orderby' => 'meta_value', // Or post by custom field
'meta_key' => 'webpage_link', // By which custom field
'order' => 'ASC', // Ascending or Descending
'post_type' => 'offices', // Just the post type
'posts_per_page' => - 1 // Show all available post
];
// The Query
$offices_query = new WP_Query($args);
if ($offices_query->have_posts()) {
while ($offices_query->have_posts()) : $offices_query->the_post();
ob_start();
get_template_part('content', get_post_type());
$output .= ob_get_clean();
endwhile;
$output .= '</ul>';
}
return $output;
}
add_shortcode('offices', 'offices_shortcode_function');
// =(end)= offices shortcode function =======
// ======= jquery google maps on 'office' custom post type =======
function my_acf_google_map_api( $api ){
$api['key'] = 'AIzaSyDrTxR-KtWbAX4BmI6ph7mrjHRmURS0Yu8';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
// =(end)= jquery google maps on 'office' custom post type =======
// ======= remove yoast meta box on edit page for 'offices' custom post types =======
function remove_yoast_metabox_reservations(){
remove_meta_box('wpseo_meta', 'offices', 'normal');
}
add_action( 'add_meta_boxes', 'remove_yoast_metabox_reservations',11 );
// =(end)= remove yoast meta box on edit page for 'offices' custom post types =======
?>