Skip to content

Instantly share code, notes, and snippets.

View frederikrosendahlkaa's full-sized avatar
:octocat:

Frederik Rosendahl-Kaa frederikrosendahlkaa

:octocat:
View GitHub Profile
@frederikrosendahlkaa
frederikrosendahlkaa / function.php
Created July 19, 2019 05:28
ACF-VC Integrator - Get google maps to show address instead of coordinator
add_filter('acfvc_google_map','acfvc_google_map_custom_output',10,3);
function acfvc_google_map_custom_output ( $output, $field, $post_id ) {
return '<iframe width="100%" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q='.urlencode( $field["value"]["address"] ).'&hl=en;z=14&amp;output=embed"></iframe>';
}
@frederikrosendahlkaa
frederikrosendahlkaa / function.php
Created April 23, 2019 16:16
ACF-VC Integrator - Add support for Star rating field ( https://github.com/kevinruscoe/acf-star-rating-field )
<?php
add_filter( 'acf_vc_add_on_fields', 'acfvc_add_addon_star_rating_field', 10, 3 );
function acfvc_add_addon_star_rating_field ( $field, $args, $post_id ) {
if ( is_array( $field ) ) {
if ( $field["type"] == "star_rating_field" ) {
if ( !empty( $field["value"] ) ) {
return $field["value"];
}
}
@frederikrosendahlkaa
frederikrosendahlkaa / acfvc_text_add_prepend_to_output.php
Last active March 4, 2019 07:00
ACF-VC Integrator - Add prepend for text field output
<?php
add_filter('acfvc_text','acfvc_text_add_prepend_to_output',10,3);
function acfvc_text_add_prepend_to_output ( $output, $field, $post_id ) {
$new_output = "<span>".$field["prepend"]."</span> ".$output;
return $new_output;
}
@frederikrosendahlkaa
frederikrosendahlkaa / acfvc_relationship_hide_unpublished_posts.php
Last active December 5, 2018 17:19
ACF-VC Integrator - Relationship field hide unpublished/private posts
<?php
add_filter('acfvc_relationship','acfvc_relationship_hide_unpublished_posts',10,3);
function acfvc_relationship_hide_unpublished_posts ( $output, $field, $id ) {
$new_output = "<ul>";
foreach ( $field["value"] as $key => $value ) {
if ( $value->post_status == "publish" ) {