Support

Account

Forum Replies Created

  • I had the same, but have noticed updating to the latest (https://github.com/elliotcondon/acf/archive/master.zip) seems to resolve it.

    Give it a go and see what happens

  • Of course!! That makes complete sense, thanks elliot!

  • It’s bizarre, if I use the options page as an include, it shows in the ACF Addons page as being there, but not option menu appears – I include it along with my other fields.

    define( 'ACF' , true );
    include_once( get_template_directory() . '/advanced-custom-fields/acf.php' );
    
    add_action('acf/register_fields', 'myown_custom_fields');
    function myown_custom_fields() {
    	include_once( get_template_directory() . '/advanced-custom-fields/acf-repeater/repeater.php');
        include_once( get_template_directory() . '/advanced-custom-fields/acf-flexible-content/flexible-content.php');
        include_once( get_template_directory() . '/advanced-custom-fields/acf-options-page/acf-options-page.php');
    }
    

    Installing it as a separate plugin, however, works fine. I don’t mind doing that, but any idea how I’d do it by bundling into my functions?

    Cheers!

  • Something like this? 🙂

    <?php if( have_rows('questions') ): ?>
     	<?php $counter = 1;  //this sets up the counter starting at 0 ?>
            <ul class="questions-answers">
         
            <?php while( have_rows('questions') ): the_row(); ?>
                
                <li><h3><a href="#"><?php the_sub_field('question_text'); ?></a></h3>
                <p class="class_<?php echo $counter; // Prints the number of counted row ?>"><?php the_sub_field('answer_text'); ?></p>
                <p><?php the_sub_field('answer_text'); ?></p></li>
                <?php $counter++; // add one per row ?>  
            <?php endwhile; ?>
         
            </ul>
    <?php endif; ?>
  • You’ll need to use wp_get_attachment_image if your using the ID – maybe something like below – havnt tested but hopefully it’ll work

    <?php 
    if(get_field('image_gallery')): ?>
        <?php while(has_sub_field('image_gallery')): ?>
    <?php 
    $attachment_id = get_sub_field('illustrations_image');
    $size = "thumbnail"; // (thumbnail, medium, large, full or custom size)
    $imageurl = wp_get_attachment_image_src( $attachment_id, 'full' );
    $image_title = $attachment->post_title;
    ?>
            <a href="<?php echo $imageurl[0] ?>" title="<?php echo $image_title; ?>"><?php echo $img; ?></a>
        <?php endwhile; ?>									 
    <?php endif; ?>
  • Its a lifetime licence i believe! And it’s not per site either, buy them all! 😀

    Not tried LP content manager, but I use ACF daily and it fulfills all of my needs and the support forum is pretty great for help

  • Use a nested repeater

    So make one repeater with these fields

    [text] - Menu Part (starter, dishes etc)
    [repeater] - Menu Items
        [text] - Dish Title
        [wsywig] - Description
        [text] - Price
    

    Then they can add a Menu part, and then in each menu part add items to these

  • You might have to use the Post Object field instead and then maybe do something like:

    <?php 
    	$post_objects = get_field('post_objects');
     
    	if( $post_objects ): ?>
    
        <?php foreach( $post_objects as $post_object): ?>
    
        	$postID = $post_object->ID
    
                <a href="<?php echo get_permalink($postID); ?>">
                	<?php echo get_the_title($postID); ?>
                </a>
    
        <?php endforeach; ?>
    <?php endif; ?>
  • I’d add a count to the loop and assign the count number as an id/class.

    E.g:

    <?php	
    	$counter = 0;  //this sets up the counter starting at 0
     
    	if(get_field( 'repeater_field' )) {
    		echo '<div>';
    		while(has_sub_field('repeater_field')) {
    			$counter++; // add one per row
    			echo '<div id="row-' . $counter . '"> STUFF </div>';
    		}
    		echo '</div>';
    	} 
    ?>
  • This in my opinion should be done with Custom Post Types – and then assign a taxonomy with that (which could be product type?) – then you can style the taxonomy archive page however you like. So you’d have all of your products displayed on your archive-custom_post_type_name_here.php and then your Product Type (taxonomy) archive as taxonomy-taxonomy_name_aka_producttype.php

    You can use a generator to create the code for Custom Post types and taxonomys here : http://themergency.com/generators/

    So overall you’d have a Products as a Custom Post Type and then Product Types as a taxonomy (this works like categories).

    Then you can add your custom fields to the Custom Post Type and display them as single-custom_post_type_name_here.php

    Hope that makes some sense!

  • Your welcome! Thank you for the plugin 🙂

  • Here’s your code with my code combined 🙂

    <?php  			
    	if(get_field('image_slider_illustrations'))
    	{
    		echo '<ul class="slider">';
    		while(has_sub_field('image_slider_illustrations'))
    		{	
    
    			$attachment_id = get_sub_field('illustrations_image');
    			$size = "full"; // (thumbnail, medium, large, full or custom size)
    			
    			$image = wp_get_attachment_image_src( $attachment_id, $size );
    
    			$attachmentinfo = get_post( $attachment_id );
    			$alt = get_post_meta($attachmentinfo->ID, '_wp_attachment_image_alt', true);
    
    			echo '<li><img src="' . $image[0] . '"  alt="' . $alt  . '"/></li> ';               
    		}	 
    		echo '</ul>';
    	}	 
    ?>

    Just tried that and got the expected result – let me know if you’ve still got no joy

  • You’ll need to have the image set as Image ID

    then use something like:

    <?php 
    				
    	$attachment_id = get_sub_field('illustrations_image');
    	$size = "full"; // (thumbnail, medium, large, full or custom size)
     				
     	$image = wp_get_attachment_image_src( $attachment_id, $size );
    
     	$attachmentinfo = get_post( $attachment_id );
    
    	$alt = get_post_meta($attachmentinfo->ID, '_wp_attachment_image_alt', true);
    
    ?>
    <img src="<?php echo $image[0]; ?>" alt="<?php echo $alt; ?>" />

    You’ll need to edit it to go in amongst your loop but hopefully you’ll get the jist.

  • You sir are a genius!

    I knew i had to have a count in there somewhere just wasnt sure how to implement it – this is exactly what I was after 🙂

  • This is awesome thanks!

Viewing 15 posts - 1 through 15 (of 15 total)