Voor de nieuwe Eemvitaal moeten er verschillende wijzigingen worden gemaakt. Onderstaand per onderdeel de wijzigingen:
Nieuwe versie FacetWP en FacetWP map facet installeren.
facetwp-map-facet-0.5.1 facetwp-3.2.13
Voeg de taxonomieën toe in de functions.php rond regel 791.
register_taxonomy("praktijk_dimensie",
array("praktijken"),
array(
"hierarchical" => true,
"label" => "Dimensie",
"singular_label" => "Dimensie",
"rewrite" => true,
"show_admin_column" => true
));
register_taxonomy("praktijk_thema",
array("praktijken"),
array(
"hierarchical" => true,
"label" => "Thema",
"singular_label" => "Thema",
"rewrite" => true,
"show_admin_column" => true
));
register_taxonomy("praktijk_diciplines",
array("praktijken"),
array(
"hierarchical" => true,
"label" => "Betrokken diciplines",
"singular_label" => "Betrokken diciplines",
"rewrite" => true,
"show_admin_column" => true
));
Vul de taxonomieën door middel van het bestand “Eemvitaal 2.0 taxonomy”
Voeg de filters toe aan FacetWP
Facet Dimensie -- dimensie Facet Thema -- thema Facet Betrokken disciplines -- disciplines
{"facets":[{"label":"Dimensie","name":"dimensie","type":"fselect","source":"tax\/praktijk_dimensie","multiple":"no","label_any":"Dimensie","parent_term":"","orderby":"raw_value","hierarchical":"no","operator":"and","count":"10"},{"label":"Thema","name":"thema","type":"fselect","source":"tax\/praktijk_thema","multiple":"no","label_any":"Thema","parent_term":"","orderby":"raw_value","hierarchical":"no","operator":"and","count":"999"},{"label":"Betrokken disciplines","name":"disciplines","type":"fselect","source":"tax\/praktijk_diciplines","multiple":"no","label_any":"Betrokken disciplines","parent_term":"","orderby":"raw_value","hierarchical":"no","operator":"and","count":"999"}]}
Pagina aanmaken “Vind een tweedelijns specialist” met template “Specialist zoeken” (page-specialist-zoeken.php)
<?php
/*
* Template name: Specialist zoeken
*/
get_header(); ?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
$.each(FWP.facets, function(name, vals) {
if (FWP.facets[name].length > 0) {
$('.facetwp-facet-' + name).addClass('is-active');
}
else {
$('.facetwp-facet-' + name).removeClass('is-active');
}
});
});
})(jQuery);
(function($) {
$(function() {
FWP.loading_handler = function() { }
});
})(jQuery);
(function($) {
$(function() {
// replace the submit button's "onclick" handler
$('.zktrng').attr('onclick', 'custom_redirect()');
// write small plugin for keypress enter detection
$.fn.enterKey = function (fnc) {
return this.each(function () {
$(this).keypress(function (e) {
var keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode == '13') {
fnc.call(this, e);
}
})
})
}
});
})(jQuery);
function custom_redirect() {
FWP.parse_facets();
FWP.set_hash();
var query_string = FWP.build_query_string();
if ('' != query_string) {
query_string = '?' + query_string;
}
pagename = '/ggz-praktijken/';
window.location.href = pagename + query_string.replace("categoriehome", "training");
//window.location.href = pagename + query_string.replace("zoeken", "zoeken");
}
</script>
<div class="container-fluid content">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12" id="main">
<h1><?php the_title(); ?></h1>
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_content(); ?>
</article>
<?php endwhile; ?>
<?php else: ?>
<article>
<h2><?php _e( 'Sorry, er is niets om te laten zien.', 'html5blank' ); ?></h2>
</article>
<?php endif; ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 zkn">
<h2>1</h2><a tabindex="0" role="button" data-toggle="popover" data-trigger="focus" title="Dimensie" data-content="Informatie over dimensie"><i class="fa fa-info inf" aria-hidden="true"></i></a>
<?php echo do_shortcode('[facetwp facet="dimensie"]'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 zkn">
<h2>2</h2><a tabindex="0" role="button" data-toggle="popover" data-trigger="focus" title="Thema" data-content="Informatie over thema"><i class="fa fa-info inf" aria-hidden="true"></i></a>
<?php echo do_shortcode('[facetwp facet="thema"]'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 zkn">
<h2>3</h2><a tabindex="0" role="button" data-toggle="popover" data-trigger="focus" title="Betrokken disciplines" data-content="Informatie over betrokken disciplines"><i class="fa fa-info inf" aria-hidden="true"></i></a>
<?php echo do_shortcode('[facetwp facet="disciplines"]'); ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 zknbtnnpdng">
<button class="zktrng" id="zknhm" data-href="/ggz-praktijken/">Zoeken</button>
</div>
<div style="display:none"><?php echo facetwp_display( 'template', 'praktijken' ); ?></div>
</div>
</div>
</div>
<div class="container-fluid afbldng">
<img src="/wp-content/themes/g5_eemvitaal/assets/img/foto.png">
</div>
<?php get_footer(); ?>
LESS toevoegen
.zkn {
.fs-label-wrap {
background: @color_links;
color: #fff;
font-size: 20px;
text-transform: none;
padding: 5px 10px;
font-weight: normal;
}
.is-active {
.fs-label-wrap {
background: @color_alt;
color: #fff;
}
}
.fs-arrow {
border: none;
&:after {
content: "\f078";
position: absolute;
right: 10px;
color: #fff;
top: -7.5px;
font-weight: lighter;
font: normal normal normal 16px/1 FontAwesome;
}
}
.fs-dropdown {
max-width: 350px!important;
}
h2 {
display: inline-block;
border-radius: 50%;
color: #fff;
background: @color_alt;
margin: 0px;
height: 25px;
width: 25px;
text-align: center;
padding: 2.5px;
font-size: 16px!important;
line-height: 1.2em;
margin-bottom: 10px;
}
i.inf {
color: @color_links;
font-size: 20px;
vertical-align: middle;
padding-left: 10px;
}
}
div.container-fluid.afbldng {
margin-top: 60px;
margin-bottom: -40px;
img {
min-width: 100%;
}
}
#zknhm {
background: @color_alt;
padding: 5px 10px;
color: #fff;
font-weight: bold;
float:right;
}
#loading {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.9);
z-index: 99999999999999999999;
.pop {
text-align: center;
max-width: 300px;
background: #fff;
padding: 20px;
margin: 0 auto;
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
left: 0;
right: 0;
color: @color_links;
strong {
color: @color_alt;
}
}
}
Menu item GGZ praktijken verwijderen en pagina “Vind een tweedelijns specialist” toevoegen aan main menu.
Homepage aanpassen naar 2 blokken (col-md-6 i.p.v. col-md-4)
Loading div invoegen bij de page-praktijk.php
<script>
setTimeout(function(){
jQuery("#loading").fadeOut();
},3000) // 3 seconds.
</script>
<div id="loading">
<div class="pop">
<strong>Eemvitaal</strong> zoekt op dit moment naar de meest passende zorg voor u.<br/><br/>
<img src="/wp-content/themes/g5_eemvitaal/assets/img/ajax-loader.gif">
</div>
</div>
Praktijk aanpassen pagina. Lijst met praktijken indien er meer zijn, anders 1 praktijk wijzigen.
<?php if ( !is_user_logged_in() ) {
wp_redirect( home_url() ); exit;
} else {
acf_form_head(); ?>
<?php get_header();
/*
* Template name: Praktijk aanpassen overzicht
*/
?>
<script>
(function($) {
acf.add_filter('select2_args', function( args, $select, settings ){
args.maximumSelectionLength = 5;
return args;
});
})(jQuery);
</script>
<div class="container-fluid hdr" style="background: url('<?php echo get_template_directory_uri(); ?>/assets/img/headervervolg.png') no-repeat center center; background-size: cover;">
</div>
<div class="container-fluid content">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12" id="main">
<h1><?php the_title(); ?></h1>
<?php
if ( is_user_logged_in() ):
global $current_user;
wp_get_current_user();
if(empty($_GET["praktijkid"])){
$author_query = array('posts_per_page' => '-1','post_type' => 'praktijken','author' => $current_user->ID);
$author_posts = new WP_Query($author_query);?>
<table>
<tr style="border-bottom: 1px solid #ccc;">
<th>Praktijk</th>
<th></th>
</tr>
<?php
while($author_posts->have_posts()) : $author_posts->the_post();
$id_praktijk = get_the_id();?>
<tr style="border-bottom: 1px solid #ccc;">
<td style="width: 80%; border-left: 1px solid #ccc; border-right: 1px solid #ccc; padding: 2.5px 5px;"><span class="ttle"><?php the_title(); ?></span></td>
<td style="padding: 2.5px 5px; border-right: 1px solid #ccc;"><a href="?praktijkid=<?php echo $id_praktijk; ?>">Praktijk aanpassen</a></td>
</tr>
<?php
endwhile;?>
</table>
<?php
} else {
$id_praktijk = $_GET['praktijkid'];
$author_query = array(
'posts_per_page' => '1',
'post_type' => 'praktijken',
'p' => $id_praktijk,
'author' => $current_user->ID);
$author_posts = new WP_Query($author_query);
if($author_posts->have_posts()) {
while($author_posts->have_posts()) : $author_posts->the_post();
?>
<h2><?php the_title(); ?></h2>
<?php
if(isset($_GET['updated'])){
if($_GET['updated'] == 'true'){
echo '<p style="color:green;font-weight:bold">Uw praktijk informatie is ge-update.</p>';
echo '<a href="'.esc_url( get_permalink($id_praktijk) ).'">Bekijk uw praktijk pagina</a>';
}
}
acf_form(array(
'post_id' => $id_praktijk,
'post_type' => 'praktijken',
'post_title' => false,
'field_groups' => array('group_59ca5ff386e12','group_59ca61d92aacb','group_5981df1fe8748'),
'post_content' => true,
'submit_value' => __("Update", 'krootz'),
'updated_message' => __("Post updated", 'acf'),
'html_updated_message' => '<div id="message" class="updated"><p>%s</p></div>',
'honeypot' => true,
'html_submit_spinner' => '<span class="acf-spinner"></span>',
'uploader' => 'basic'
)); ?>
<?php
endwhile;
} else {
echo "De geselecteerde praktijk kan niet worden gevonden.";
};
}
else :
endif;?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
<?php };?>
#changelog #eemvitaal #updates