Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MSF
/
msf-climate-hub
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0eef9c67
authored
2023-11-23 12:19:27 -0500
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
code cleanup
Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent
dbbebefb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 additions
and
304 deletions
wp-content/themes/msf-child/inc/blocks.php
wp-content/themes/msf-child/inc/commands_tax.php
wp-content/themes/msf-child/inc/inc.php
wp-content/themes/msf-child/inc/search-extras.php
wp-content/themes/msf-child/inc/side-menu.php
wp-content/themes/msf-child/inc/blocks.php
View file @
0eef9c6
...
...
@@ -32,9 +32,9 @@ if( function_exists('acf_add_options_page') ) {
));
acf_register_block
(
array
(
'name'
=>
'call-out-block'
,
'title'
=>
__
(
'Call Out Block'
),
'description'
=>
__
(
'A custom block for Call Out Block items.'
),
'name'
=>
'call-out-block'
,
'render_template'
=>
'blocks/call-out-block/call-out-block.php'
,
'mode'
=>
'edit'
,
));
...
...
wp-content/themes/msf-child/inc/commands_tax.php
deleted
100644 → 0
View file @
dbbebef
<?php
require_once
(
ABSPATH
.
'wp-admin/admin.php'
);
//add_action('init','register_country_taxonomy');
function
register_country_taxonomy
()
{
error_log
(
'dddd'
);
$counties
=
array
(
"Afghanistan"
,
"Albania"
,
"Algeria"
,
"Andorra"
,
"Angola"
,
"Antigua and Barbuda"
,
"Argentina"
,
"Armenia"
,
"Australia"
,
"Austria"
,
"Azerbaijan"
,
"Bahamas"
,
"Bahrain"
,
"Barbados"
,
"Belarus"
,
"Belgium"
,
"Belize"
,
"Benin"
,
"Bhutan"
,
"Bolivia"
,
"Bosnia and Herzegovina"
,
"Botswana"
,
"Brazil"
,
"Brunei"
,
"Bulgaria"
,
"Burkina Faso"
,
"Burundi"
,
"Cabo Verde"
,
"Cambodia"
,
"Canada"
,
"Central African Republic"
,
"Chile"
,
"China"
,
"Columbia"
,
"Comoros"
,
"Congo"
,
"Costa Rica"
,
"Croatia"
,
"Cuba"
,
"Cyprus"
,
"Czech Republic"
,
"Denmark"
,
"Djibouti"
,
"Dominica"
,
"Dominican Republic"
,
"East Timor"
,
"Ecuador"
,
"El Salvador"
,
"Equatorial Guinea"
,
"Eritrea"
,
"Estonia"
,
"Eswatini"
,
"Ethiopia"
,
"Fiji"
,
"Finland"
,
"France"
,
"Gabon"
,
"Gambia"
,
"Georgia"
,
"Germany"
,
"Ghana"
,
"Greece"
,
"Grenada"
,
"Guatemala"
,
"Guinea"
,
"Guinea"
,
"Guyana"
,
"Hungary"
,
"Iceland"
,
"Indonesia"
,
"Iran"
,
"Iraq"
,
"Ireland"
,
"Israel"
,
"Italy"
,
"Jamaica"
,
"Japan"
,
"Jordan"
,
"Kazakhstan"
,
"Kenya"
,
"North Korea"
,
"South Korea"
,
"Kuwait"
,
"Kyrgyzstan"
,
"Laos"
,
"Latvia"
,
"Lesotho"
,
"Libya"
,
"Liberia"
,
"Liechtenstein"
,
"Lithuania"
,
"Luxembourg"
,
"Madagascar"
,
"Malawi"
,
"Malaysia"
,
"Maldives"
,
"Mali"
,
"Malta"
,
"Marshall Islands"
,
"Mauritania"
,
"Mauritius"
,
"Mexico"
,
"Micronesia"
,
"Moldova"
,
"Monaco"
,
"Mongolia"
,
"Montenegro"
,
"Morocco"
,
"Mozambique"
,
"Myanmar"
,
"Namibia"
,
"Nauru"
,
"Nepal"
,
"Netherlands"
,
"New Zealand"
,
"Nicaragua"
,
"Nepal"
,
"Nigeria"
,
"North Macedonia"
,
"Norway"
,
"Oman"
,
"Palau"
,
"Panama"
,
"Papua New Guinea"
,
"Paraguay"
,
"Peru"
,
"Philippines"
,
"Poland"
,
"Portugal"
,
"Qatar"
,
"Romania"
,
"Russia"
,
"Rwanda"
,
"Saint Kitts and Nevis"
,
"Saint Lucia"
,
"Saint Vincent and the Grenadines"
,
"Samoa"
,
"San Marino"
,
"Sao Tome and Principe"
,
"Saudi Arabia"
,
"Senegal"
,
"Serbia"
,
"Seychelles"
,
"Sierra Leone"
,
"Singapore"
,
"Slovakia"
,
"Slovenia"
,
"Solomon Islands"
,
"Somalia"
,
"South Africa"
,
"Spain"
,
"Sri Lanka"
,
"Sudan"
,
"Suriname"
,
"Sweden"
,
"Switzerland"
,
"Syria"
,
"Taiwan"
,
"Tajikistan"
,
"Tanzania"
,
"Thailand"
,
"Togo"
,
"Tonga"
,
"Trinidad and Tobago"
,
"Tunisia"
,
"Turkey"
,
"Turkmenistan"
,
"Tuvalu"
,
"Uganda"
,
"Ukraine"
,
"United Arab Emirates"
,
"United Kingdom"
,
"United States"
,
"Uruguay"
,
"Uzbekistan"
,
"Vanuatu"
,
"Vatican City"
,
"Venezuela"
,
"Vietnam"
,
"Yemen"
,
"Zambia"
);
foreach
(
$counties
as
$country
)
{
register_taxonomy
(
'country'
,
'attachment'
,
array
(
'hierarchical'
=>
true
,
'label'
=>
$country
,
'query_var'
=>
clean
(
$country
),
));
register_taxonomy
(
'country'
,
'documents'
,
array
(
'hierarchical'
=>
true
,
'label'
=>
$country
,
'query_var'
=>
clean
(
$country
),
));
}
}
function
clean
(
$string
)
{
$string
=
str_replace
(
' '
,
'-'
,
$string
);
// Replaces all spaces with hyphens.
return
preg_replace
(
'/[^A-Za-z0-9\-]/'
,
''
,
$string
);
// Removes special chars.
}
\ No newline at end of file
wp-content/themes/msf-child/inc/inc.php
View file @
0eef9c6
...
...
@@ -7,7 +7,6 @@ require_once 'shortcodes.php';
require_once
'search-extras.php'
;
require_once
'disable-comments.php'
;
require_once
'blocks.php'
;
require_once
'side-menu.php'
;
require_once
'widgets-area.php'
;
require_once
'commands.php'
;
require_once
'rest.php'
;
...
...
wp-content/themes/msf-child/inc/search-extras.php
View file @
0eef9c6
...
...
@@ -16,23 +16,6 @@ function wptp_add_tags_to_attachments() {
add_action
(
'init'
,
'wptp_add_tags_to_attachments'
);
function
filter_query_args
(
$query_args
,
$sfid
)
{
error_log
(
print_r
(
$query_args
,
true
));
//$query_args['posts_per_page'] = -1;
//$query_args['orderby'] = 'relevance';
//$query_args['order'] = 'ASC';
return
$query_args
;
}
add_filter
(
'sf_edit_query_args'
,
'filter_query_args'
,
99
,
2
);
function
relevant_search_result
(
$q
)
{
if
(
is_search
()
&&
is_main_query
()
)
$q
->
set
(
'orderby'
,
'relevance'
);
$q
->
set
(
'order'
,
'ASC'
);
}
//add_action( 'pre_get_posts', 'relevant_search_result' );
add_action
(
'init'
,
'set_exclude_from_search'
);
function
set_exclude_from_search
()
...
...
wp-content/themes/msf-child/inc/side-menu.php
deleted
100644 → 0
View file @
dbbebef
<?php
/**
* Use wp_list_pages() to display parent and all child pages of current page.
*/
function
wpse_get_ancestor_tree
()
{
// Bail if this is not a page.
if
(
!
is_page
()
)
{
return
false
;
}
// Get the current post.
$post
=
get_post
();
/**
* Get array of post ancestor IDs.
* Note: The direct parent is returned as the first value in the array.
* The highest level ancestor is returned as the last value in the array.
* See https://codex.wordpress.org/Function_Reference/get_post_ancestors
*/
$ancestors
=
get_post_ancestors
(
$post
->
ID
);
// If there are ancestors, get the top level parent.
// Otherwise use the current post's ID.
$parent
=
(
!
empty
(
$ancestors
)
)
?
array_pop
(
$ancestors
)
:
$post
->
ID
;
// Get all pages that are a child of $parent.
$pages
=
get_pages
(
[
'child_of'
=>
$parent
,
]
);
// Bail if there are no results.
if
(
!
$pages
)
{
return
false
;
}
// Store array of page IDs to include latere on.
$page_ids
=
array
();
foreach
(
$pages
as
$page
)
{
$page_ids
[]
=
$page
->
ID
;
}
// Add parent page to beginning of $page_ids array.
array_unshift
(
$page_ids
,
$parent
);
// Get the output and return results if they exist.
$output
=
wp_list_pages
(
[
'include'
=>
$page_ids
,
'title_li'
=>
false
,
'echo'
=>
false
,
]
);
if
(
!
$output
)
{
return
false
;
}
else
{
return
'<ul class="side-menu ancestor-tree">'
.
PHP_EOL
.
$output
.
PHP_EOL
.
'</ul>'
.
PHP_EOL
;
}
}
\ No newline at end of file
Please
register
or
sign in
to post a comment