This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pas alleen '=bidirectional_relationship' aan naar de juiste veldnaam. werkt ook tussen verschillende CPT's. veld kan apart aangemaakt worden in verschillende groepen, als het maar dezelfde naam heeft. | |
function bidirectional_acf_update_value( $value, $post_id, $field ) { | |
// vars | |
$field_name = $field['name']; | |
$global_name = 'is_updating_' . $field_name; | |
// bail early if this filter was triggered from the update_field() function called within the loop below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( $column_name == 'teams' ) { | |
if( have_rows('Stand') ){ | |
while ( have_rows('Stand') ) : the_row(); | |
// http://www.advancedcustomfields.com/resources/post-object/ | |
// https://codex.wordpress.org/Class_Reference/WP_Post#Accessing_the_WP_Post_Object | |
$post_objects = get_sub_field('team'); | |
echo $post_objects->ID; // Display the post's ID | |
echo apply_filters( 'the_content', $post_objects->post_title ); // Do this instead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// | |
// Template helper functions | |
// | |
function mkr_is_first_post( $query = false ) { | |
if ( ! $query ) { | |
global $wp_query; | |
$query = $wp_query; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delete role | |
remove_role( 'coordinator' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add role (voer dit eenmalig uit) | |
// Voeg coordinator toe | |
$result = add_role( | |
'coordinator', | |
__( 'Coördinator' ), | |
array( | |
'read' => true, | |
'edit_posts' => true, | |
'delete_posts' => false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sorteer Taxonomy field op volgorde naam in dashboard | |
function mkr_acf_taxonomy_field_dashboard_order( $args, $field, $post_id ) { | |
$args['orderby'] = 'name'; | |
$args['order'] = 'DESC'; | |
// return | |
return $args; | |
} | |
add_filter('acf/fields/taxonomy/query/name=gebied', 'mkr_acf_taxonomy_field_dashboard_order', 10, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable een standaard tekst veld(werkt niet op input en select fields) | |
function mkr_acf_disable_text_fields( $field ) { | |
$user_role = 'coordinator'; | |
if( current_user_can( $user_role )) { | |
$field['disabled'] = 1; | |
} else { | |
$field['disabled'] = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mkr_acf_disable_fields_competitie() { | |
// Add the role that !!can not!! edit here | |
$user_role = 'coordinator'; | |
if( current_user_can( $user_role ) ) { ?> | |
<script type="text/javascript"> | |
(function($) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mkr_acf_repeater_sort_dashboard( $value, $post_id, $field ) { | |
$order = array(); | |
if( empty($value) ) { | |
return $value; | |
} | |
// Order | |
foreach( $value as $i => $row ) { |