Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • I have the same question. I have spent over 2 hours trying to figure out how to get the slider to work. The coded used in your video on the http://www.advancedcustomfields.com/add-ons/gallery-field/ page does not match with the files in the add-on.

    Where is the flexslider.js and flexslider.css files? Do I have to go to their site and get them? Your documentation is very unclear about this.

    Also, it would be nice if you had the code for what files need to be included in your documentation, such as, <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/flexslider.css" type="text/css">
    Only seen this code in the tutorial video.

  • Nothing too unusual really. I don’t have the code on-hand, but take a repeater field setup, for example, where you loop through the different sub-fields…

    I would like a particular piece of my markup, contained in the loop, to have a unique class name for each instance of, say, a particular sub-field. Rather than use a $count where you just assign a number to a class (ie: class-1, class-2…) for this sub-field, I’m wondering if there is a way to pull a unique identifier for that sub-field to use as a classname in the markup (ie: fieldname-12)?

  • I’ve edited this because I’ve found the solution for the problem, and I was doing this completelly wrong. I forgot to check if there where checkboxes active or not.

    Yet I would like that the images also appeared at the backend. How could I do this?

    Thank you once again.
    AMP.

  • Hi
    A great queston that i think many developers Face.

    @elliot
    i hope you pick this up now when you focus full time on acf. Maybee start out adding a best practice workflow with existing version (when using Git and local/online enviroments) and then brainstorm around improvments for next version.

  • I had no luck changing the order, but I’ve fixed this by just unsetting the post data, then adding it back on after the user has been created. Here’s the complete function, in case it’s of use to someone else.

    add_filter('publish_homeowner', 'homeowner_postdata');
    function homeowner_postdata( $post_id ) {
    	global $wpdb;
    	$username = preg_replace("/[^A-Za-z0-9]/", "", strtolower(get_the_title($post_id)));
    	$email = preg_replace("/[^A-Za-z0-9]/", "", strtolower(str_replace(" ", ".", get_the_title($post_id))));
            $random_password = wp_generate_password( 8, false );
            $userargs = array(
                 'user_pass' => $random_password,
            	'user_login' => $username,
            	'user_email' => $email,
            	'role' => 'homeowner'
            );
            $acf_nonce = $_POST['acf_nonce'];
            $_POST['acf_nonce'] = '';
    	$status = wp_insert_user( $userargs );  
            if ( is_wp_error($status) )  {
                //echo "User not created.";  
            } else {
                $_POST['acf_nonce'] = $acf_nonce;
                //echo "User created.";  
            }
         }
    }
  • Sorry for the lack of detail Elliot and thanks for the reply. This isn’t an ACF issue. It’s more of a general PHP question and I was hoping to tap the ACF community. If that sort of a question doesn’t belong here let me know and I can post elsewhere. That being said…

    The code above works. I just know there’s a better way to do it and I couldn’t figure it out. The 3 sets of “column” field names (examples: cb_3_col_main_header, cb_3_col_1_link) are templated so to speak with the second number going from 1-3 within each column set. I should have done this in the first place but below I’ve simplified the code where you can see how the sub field names increment 1-3 within each <div> .columns set. Is there a way to do this with a loop, array(s) and a counter so the _1_, _2_, _3_ portions of the field names are all dynamic.

    Wow this feels like I’m not doing a good job of explaining. 😐 Hopefully the simplified code below is much easier in terms of demonstrating my question.

    <?php if(get_row_layout() == '3_column_layout'): ?>
    
    	<div class="row">
    		
    		<div class="small-12 large-4 columns">
    			<dl>
    				<dt><?php the_sub_field('cb_3_col_1_header'); ?></dt>
    				<dd><?php the_sub_field('cb_3_col_1_copy'); ?></dd>
    				<dd><?php the_sub_field('cb_3_col_1_link'); ?></dd>
    			</dl>
    		</div>
    
    		<div class="small-12 large-4 columns">
    			<dl>
    				<dt><?php the_sub_field('cb_3_col_2_header'); ?></dt>
    				<dd><?php the_sub_field('cb_3_col_2_copy'); ?></dd>
    				<dd><?php the_sub_field('cb_3_col_2_link'); ?></dd>
    			</dl>
    		</div>
    		
    		<div class="small-12 large-4 columns">
    			<dl>
    				<dt><?php the_sub_field('cb_3_col_3_header'); ?></dt>
    				<dd><?php the_sub_field('cb_3_col_3_copy'); ?></dd>
    				<dd><?php the_sub_field('cb_3_col_3_link'); ?></dd>
    			</dl>
    		</div>
    		
    	</div>
    
    <?php endif; ?>
  • <?php if( get_field('developer') ): ?>
    <?php $args = array('taxonomy' => 'game_developer'); ?>
    <?php $tax_menu_items = get_categories( $args );
    foreach ( $tax_menu_items as $tax_menu_item ):?>
    <p>Developer:<a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>"> <?php echo $tax_menu_item->name; ?></a></p>
    <?php endforeach; ?><?php endif; ?>
    

    Got it working with above code 😀 Now few tweaks and full steam ahead.

  • There we go!

    Including the exported fields inside an init function did the trick:

    add_action('init', 'load_exported_fields');
    function load_exported_fields(){
    	include 'acf-exported-fields.php';
    }
    

    I would like to do a request.

    As i mentioned before, you have a function that wraps certain fields in __() in your nightly build in the file:
    /core/controllers/export.php on line 387:

    // add the WP __() function to specific strings for translation in theme
    				$html = preg_replace("/'label'(.*?)('.*?')/", "'label'$1__($2)", $html);
    				$html = preg_replace("/'instructions'(.*?)('.*?')/", "'instructions'$1__($2)", $html);

    Could you make this include other necessary fields as well? For example: ‘title’, ‘choices’, ‘sub_fields’, ‘layouts/sub_fields’?

    Or are you planning on some other way to translate fields?

    I would also like to report a bug.
    When i export fields that have the following location values they show up on every page with a loading sign going on and on, see attached file. Do you know why?

    'location' => array (
    			array (
    				array (
    					'param' => 'options_page',
    					'operator' => '==',
    					'value' => 'acf-options-admin',
    					'order_no' => 0,
    					'group_no' => 0,
    				),
    				array (
    					'param' => 'user_type',
    					'operator' => '==',
    					'value' => 'administrator',
    					'order_no' => 1,
    					'group_no' => 0,
    				),
    			),
    		),

    Thank you Elliot!

  • Thanks Elliott; that works a treat for the top-level fields. There doesn’t appear to be a filter hook for all elements; e.g. sub_fields. Have I overseen something?

    Do you foresee an ongoing requirement to handle multilingual issues like this via gettext functions and external .po / .mo files?

  • Hi Elliot,

    the relationship relates to a custom post type “Product” with a Category.

    Imagine the Category is a Magazine Issue which has Posts (default WP functionality) and then this Magazine Issue Category is connected to a Product to buy the printed Issue. I now want to link to the Category which is connected to the Product from the Product Page. Does this make sense?

    The Code would run on the Template displaying the Products (CPT) where I’d try to query: “Get the Category ID of the Category related to this Product ID”.

    Does this make it clearer?

  • No was a total error. Been grinding for 3 days with zero luck getting data. Put messy code together just to show it to find out why only ID’s where called. Just updated with you recommended document code again.

    <?php $post_object = get_field('get_game_details');
    if( $post_object ): 
    	// override $post
    	$post = $post_object;
    	setup_postdata( $post ); ?>
            <?php get_template_part( 'game_details', 'index' ); ?>
        <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>

    However I still cannot figure out why only ID's are called and not the display of the data.
    For Example – 47 = Pokemon X & Y

    To further explain. When viewed from normal post type all data is fully visible. However when viewed from my custom post type 'Games Information' (that also uses custom Toxonomys), all the data is simple ID's.

    add_action( 'init', 'register_cpt_game_information' );
        function register_cpt_game_information() {
        $labels = array(
        'name' => _x( 'Games Information', 'game_information' ),
        'singular_name' => _x( 'Game Information', 'game_information' ),
        'add_new' => _x( 'Add New', 'game_information' ),
        'add_new_item' => _x( 'Add New Game Information', 'game_information' ),
        'edit_item' => _x( 'Edit Game Information', 'game_information' ),
        'new_item' => _x( 'New Game Information', 'game_information' ),
        'view_item' => _x( 'View Game Information', 'game_information' ),
        'search_items' => _x( 'Search Games Information', 'game_information' ),
        'not_found' => _x( 'No games information found', 'game_information' ),
        'not_found_in_trash' => _x( 'No games information found in Trash', 'game_information' ),
        'parent_item_colon' => _x( 'Parent Game Information:', 'game_information' ),
        'menu_name' => _x( 'Games Information', 'game_information' ),
        );
        $args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
        'taxonomies' => array( 'category', 'post_tag' ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 5,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'
        );
        register_post_type( 'game_information', $args );
        }
    add_action( 'init', 'register_taxonomy_game_title' );
        function register_taxonomy_game_title() {
        $labels = array(
        'name' => _x( 'Game Title', 'game_title' ),
        'singular_name' => _x( 'Games Title', 'game_title' ),
        'search_items' => _x( 'Search Game Title', 'game_title' ),
        'popular_items' => _x( 'Popular Game Title', 'game_title' ),
        'all_items' => _x( 'All Game Title', 'game_title' ),
        'parent_item' => _x( 'Parent Games Title', 'game_title' ),
        'parent_item_colon' => _x( 'Parent Games Title:', 'game_title' ),
        'edit_item' => _x( 'Edit Games Title', 'game_title' ),
        'update_item' => _x( 'Update Games Title', 'game_title' ),
        'add_new_item' => _x( 'Add New Games Title', 'game_title' ),
        'new_item_name' => _x( 'New Games Title', 'game_title' ),
        'separate_items_with_commas' => _x( 'Separate game title with commas', 'game_title' ),
        'add_or_remove_items' => _x( 'Add or remove game title', 'game_title' ),
        'choose_from_most_used' => _x( 'Choose from the most used game title', 'game_title' ),
        'menu_name' => _x( 'Game Title', 'game_title' ),
        );
        $args = array(
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => true,
        'show_admin_column' => false,
        'hierarchical' => true,
        'rewrite' => true,
        'query_var' => true
        );
        register_taxonomy( 'game_title', array('game_information'), $args );
        }
  • My bad, i copied and pasted the wrong code. ( i said my custom field is “category_image” but really is “immagine_categoria” same thing…)

    
    $category_image = get_field('immagine_categoria', 'custom_catalog_category_39');
    $size = "page-header";
    $imgURL = wp_get_attachment_image_src( 39,  $size);
    var_dump($imgURL);
    

    This returns bool(false)

  • Hello,

    Yes, the custom taxonomy is visible and usable on each custom post edit page. It can be queried just fine everywhere else on the site.

    Could this be a problem with custom capabilities assigned to my custom post type (nothing spectacular, just renames “edit_posts” to “edit_cpts” and so on)?

    EDIT:

    Read through the core plugin code and noticed this line of code in the function that populates the select choices (get_taxonomies_for_select in acf.php) for the taxonomy filter:

    if(!is_taxonomy_hierarchical($taxonomy)) continue;

    I have my taxonomy as non-hierarchical and this seems to be the problem. I can’t seem to remember any notice of this on the field’s documentation page?

    Luckily my taxonomy will work about the same even if it is not non-hierachical, but will there be an update to allow filtering with these taxonomies too?

  • Hi @thecorkboard

    When you say “I need to pull a number of the values and create variables out of them in order to build some specific URLs and also to develop a query that pulls the latest posts from this particular category.”, I don’t understand what you are asking.

    Can you be very clear and specific?

    Thanks
    E

  • Hi @Brian Larson

    I don’t understand the question from just the title, you will need to explain the issue with more detail.

  • Hi @tommie

    Thanks for the questions.

    1. There is no releases date for v5. It could be a few months, or perhaps a year.
    2. No, ACF will only ever be a custom field manager, not a post type manager. I would continue to use the plugin you have, or think about writing the code manually in your functions.php file.

    Thanks
    E

  • Hi @thecorkboard

    I think the solution to the issue in your description itself. You say that you are only saving the yy. ACF would require that you save the yy, mm, and dd to render a value into the date picker field.

    To sum up, your save_format requires more than just the yy value.

    Thanks
    E

  • Hi @jtpnet

    exactly, this will require the flexible content field, or repeater field add-on.

    Please check out the add-on section for more info.

    Thanks
    E

  • Hi @ildaniel8

    exactly, your code requires a $attachment_id and $size variable, however your code does not demonstrate that either of these exist.

    Thanks
    E

  • Hi @duuuaaaane

    Can you please explain your request with more detail? Currently, it doesn’t make sense and I can’t offer any help.

    Thanks
    E

  • Hi @vinofanten

    Just to clarify, is the field in question an image field? What is the return type option for this field? Is is set to return the image ID?

    If so, then it is doing exactly what you told it to. Please read the docs to find out how to render an image

    Thanks
    E

  • Hi @Ian

    That is because your filter runs BEFORE ACF has saved any postmeta data.

    Instead of using get_field( "firstname" ), you will need to find the value from the $_POST array. Please note that all data is posted via it’s field key, not field name.

    You can learn more about this in the docs.

    Thanks
    E

  • Hi @TripleM

    Thanks for the bug report. It seems that because ACF creates a hidden WYSIWYG on the page (required for the WYSIWYG to work), the active editor variable is being set to this hidden field instead of the main content area…

    If you were to first click in the main WYSIWYG, then click the shortcode button, does it work correctly?

  • Hi @aplusplus

    May I ask why you have used a relationship field on a taxonomy to relate the taxonomy to a post?

    The point of a taxonomy is that it can be easily related to a post by standard WP functionality. Perhaps you don’t need the relationship field at all?

    That said, to write the code, you first need to explain on what template the code is to run. What is the current WP query on this template and what is the url to access it?

  • Elliot,
    Thanks for the quick follow-up. I’m working on the issue with the system admin and think there may possibly be another issue that began.

    Best Regards,
    -Thomas

Viewing 25 results - 20,226 through 20,250 (of 21,331 total)