Last active
August 29, 2015 14:13
-
-
Save iainmcampbell/c71b09e7237b5898aaa0 to your computer and use it in GitHub Desktop.
Advanced Custom Fields
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 | |
$imageID = get_field('image_field_name'); // set this field to return Image ID | |
$size = 'full'; // thumbnail, medium, large, full | |
$img = wp_get_attachment_image_src( $imageID, $size ); | |
if( !empty($image) ): | |
$url = $img[0]; | |
$width = $img[1]; | |
$style = 'max-width:'.$width.'px'; | |
?><img src="<?php echo $url ?>" style="<?php echo $style ?>"><?php | |
endif; | |
?> |
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 | |
acf_add_options_page(array( | |
'page_title' => 'Theme Settings', | |
'menu_title' => 'Theme Settings', | |
'menu_slug' => 'theme-settings', | |
'capability' => 'edit_posts', | |
'redirect' => 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
<?php | |
if( have_rows('repeater_field_name') ): | |
while( have_rows('repeater_field_name') ): | |
echo get_sub_field('sub_field_name'); | |
endwhile; | |
endif; | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment