Skip to content

Instantly share code, notes, and snippets.

View dgoze's full-sized avatar
💭
I may be slow to respond.

Daniel dgoze

💭
I may be slow to respond.
View GitHub Profile
@dgoze
dgoze / WP_Tiimeline
Created April 30, 2016 05:10 — forked from ndmdn/WP_Tiimeline
An example of a WP Loop that builds a timeline page using ACF and CodyHouse Vertical CSS3 Timeline
function timeline_loop() {
$args = array(
'meta_key' => 'historical_date',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'posts_per_page'=> '100',
);
echo '<section id="cd-timeline" class="cd-container">';
@dgoze
dgoze / ACF Post Meta - Options.php
Created April 30, 2016 05:11 — forked from besimhu/ACF Post Meta - Options.php
Get ACF options without using ACF functions.
<?php
$acf_field_one = get_option( 'options_acf_field_one' );
$acf_field_two = get_option( 'options_acf_field_two' );
@dgoze
dgoze / acf_check_postname.php
Created April 30, 2016 05:12 — forked from carfis/acf_check_postname.php
Function change the Post Title and Custom Taxonomy with ACF Front Page Form
// check if this is to be a new post
if( $post_id != 'new' )
{
if (get_the_title($post_id) != $_POST['acf']['field_5434172d1d00f'] ){
$update_post = array(
'ID' => $post_id,
'post_title' => $_POST['acf']['field_5434172d1d00f']
);
// Update the post into the database
@dgoze
dgoze / ACF Post Meta - Repeater.php
Created April 30, 2016 05:14 — forked from besimhu/ACF Post Meta - Repeater.php
Get ACF repeaters without using the ACF functions.
<?php
// get post ID
$pid = get_the_ID();
// get our repeater
$repeater = get_post_meta( $pid, 'acf_repeater_slug', true );
if( !empty($repeater) ) {
for( $i = 0; $i < $repeater; $i++ ) {
@dgoze
dgoze / ACF Post Meta - Single.php
Created April 30, 2016 05:14 — forked from besimhu/ACF Post Meta - Single.php
Get ACF field without using the ACF functions.
<?php
// get post ID
$pid = get_the_ID();
// acf field
$acf_field = get_post_meta( $pid, 'acf_field_slug', true );
@dgoze
dgoze / ACF Post Meta - Repeater chaining.php
Created April 30, 2016 05:14 — forked from besimhu/ACF Post Meta - Repeater chaining.php
Get ACF repeater within a repeater without using ACF functions.
<?php
// get post ID
$pid = get_the_ID();
// get our repeater
$repeater = get_post_meta( $pid, 'acf_repeater_slug', true );
if ( !empty($repeater) ) {
for( $i = 0; $i < $repeater; $i++ ) {
@dgoze
dgoze / acf_page_ancestor.php
Created April 30, 2016 05:15 — forked from pburke/acf_page_ancestor.php
ACF Page Ancestor rule
<?php
/**
* Modified from: https://github.com/zzgael/wordpress-acf-custom-location-rule-descendant-of-page
*/
add_filter('acf/location/rule_types', 'custom_acf_location_rules_types');
function custom_acf_location_rules_types( $choices ) {
$choices['Page']['page_ancestor'] = 'Page Ancestor';
return $choices;
}
@dgoze
dgoze / acf_load_field_choices.php
Created April 30, 2016 05:15 — forked from kjbrum/wp_acf_load_field_choices.php
Add custom options to an ACF field.
<?php
/**
* ACF Load Field Choices.
*
* @param array $field The field that we are going to add options to
* @return array $field The field we modified
*/
function acf_load_field_choices( $field ) {
// Reset choices
$field['choices'] = array();
@dgoze
dgoze / acf_lat_lng.php
Created April 30, 2016 05:17 — forked from leanda/acf_lat_lng.php
Display the longitude and latitude corodinates using ACF and Google Map field.
<?php
$location = get_field('your_location');
if( !empty($location) ):
?>
<?php echo $location['lat']; ?>
<?php echo $location['lng']; ?>
<?php endif; ?>
@dgoze
dgoze / acf_select_gravity_forms.php
Created April 30, 2016 05:17 — forked from cfxd/acf_select_gravity_forms.php
Populate ACF Select Field with Gravity Forms
<?php
function populate_gravity_forms($field) {
echo '<h1>acf/load_field filter debug within populate_gravity_forms()</h1>';
if(class_exists('RGFormsModel')) {
$forms_array = array();
$forms = RGFormsModel::get_forms(null, 'title');
foreach($forms as $form) {