Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • Discovered why our issue is happening. It’s because we call register_field_group() on the backend but not the frontend so the acf-field cpt entry is not detected.

    in /api/api-field.php in the _acf_get_field_by_key() method it users a get_posts query that looks for the custom field, but it’s not added in.

    So get_rows for repeater fields depends on the custom fields being in the db, where as get_field() does not.

  • Oops, found the problem. This works:

    <?php echo do_shortcode( '[acf field="my_map"]' ) ?>

  • You can get the value of the field and set to a variable then verify the options. Here is the code:

    <?php 
    
    $option =  $the_field('myfield');
    
    if($option == "1"){ $color = "red";}
    elseif($option == "2"){ $color = "blue"; }
    elseif($option == "3"){$color = "green"; }
    
    ?>
    
    <div style="background-color: <?php echo $color; ?>; ">My Content</div>

    Of course there is other ways to do it, like an array with the options and the colors etc.. but the ideia is the same.

    Hope this helps you. =D

  • Thank you ever so much. I will take a look at this and reply as soon as possible.

    Can you confirm that the images are showing for you? After a quick go, I still can’t get them to work?

    I’m using V4 if that makes a difference? Perhaps V5 would work better?

  • ACF do not offer the option to see how many characters he/she’s got left but you can do this through jquery, create a file example.js on your theme folder and then link it to your backend, get the ID of the field and done.

    http://www.scriptiny.com/2012/09/jquery-input-textarea-limiter/

  • I don’t know exactly what you want but here is what i think it is:

    You can assign the custom forms to widgets, unfortunately it’s only possible on ACF5.

    First step is creating your widget:

    class CustomWidget extends WP_Widget {
    	function __construct() {
    		parent::__construct(
    			'custom_widget', // Base ID
    			__('CustomWidget', 'text_domain'), // Name
    			array( 'description' => __( 'Some CustomWidget', 'text_domain' ), ) 
    		);
    	}
    }
     
    // register Foo_Widget widget
    function register_foo_widget() {
        register_widget( 'CustomWidget' );
    }
    add_action( 'widgets_init', 'register_foo_widget' );

    After that, on the menu go Custom Fields > Custom Fields > Your Field > At the Location tab (Rules) choose on the first select “Widget” after that select “is equal to” and the name of your widget, in this case: “CustomWidget”.

    After that save your field, go to theme > widget and drag and drop your widget on the area that you want.

    I’m sending 2 pictures, on of the configuration field, and the other is the widget panel.

    Hope this helps you! =D

  • Hello,

    Ok I will not use the repeater field but only taxonomy field.
    If you could just put a maximum limit on this field would be the best!?
    I hope you find an answer soon !!
    Thank you

    You do not talk about the other question. Less important but here it is:
    taxonomy post_format
    I can not select the post-form “link” to store in post_format?
    The test site uses wordpres twenty fourteen (compatible with post-format)
    If you give me a solution (function.php) Automatically assign to a post-file (link) to a category (websites) that ‘might be better

    Regards
    Hervé

  • Oops

    <?php foreach (get_the_terms(get_the_ID(), 'models') as $cat) : ?>
    <a href="<?php echo get_term_link($cat->term_id, 'models'); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /><?php echo $cat->name; ?> </a> </li>
    <?php endforeach; ?>
  • Aother attempt for the code that disappeared in the b-quote

    <?php foreach (get_the_terms(get_the_ID(), ‘models’) as $cat) : ?>
    term_id, ‘models’); ?>”>term_id); ?>” /><?php echo $cat->name; ?>
    <?php endforeach; ?>

  • Seeing this same issue:

    when I deactivate ACF 5 Pro and reactivate ACF 4, and then go back to ACF 5 Pro, I get prompted to upgrade the database again, and each time I perform the upgrade I get another copy of the field groups.

    Seems like ACF should be avoiding this duplication somehow or tracking whether the upgrade has already happened. (I’m on the edge of whether ACF should support upgrading, downgrading, making changes, and upgrading again.)

  • Hey Kawaisin,

    This should do the trick (untested):

    <?php
    if(have_rows("tombstones"))
    {
    	$tombstonescount = 0;
    	while( have_rows("tombstones") )
    	{
    		$tombstonescount++;
    		$class = '';
    		$image = get_sub_field('tombstone_image');
    		if(i % 3 == 0)
    		{
    			$class .= 'last';
    		}
    		?>
            <div class="one_third <?php echo $class;?>">
            <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" title="<?php echo $image['title'] ?>" />
            </div>
            <?php
    	}
    }
    ?>
  • Got the very same problem with 4.3.8, but only for other user roles than administrators. I use the following code to achieve that the users can only edit their own posts:

    
    add_action('pre_get_posts', 'query_set_only_author' );
    	function query_set_only_author( $wp_query ) {
    		$screen = get_current_screen();
    
    		if ($screen->base === 'post')
    	    		return $query; // From ACF Support Forum
    
    	    global $current_user;
    	    if( is_admin() && !current_user_can('edit_others_veranstaltungen') ) {
    	        $wp_query->set( 'author', $current_user->ID );
    	        add_filter('views_edit-veranstaltung', 'fix_veranstaltungen_counts');
    	    }
    	}

    Any ideas to fix that problem? I searched the ACF js but it didn’t help me.

  • Can you try ACF 5 with WPML 3.1.5 or older ones ?

    Also i had problems with them also, on WPML, and after a quick chat they told me author of ACF isnt responding to their mails, dont want to work with wpml bla bla, im 70% shure its not true…

    Would love if @Elliot can say anything about situation, and me2 also think they want us to use Tools (plus buy Views).. i dont care i did use Tools and Views, but dont want it anymore, i slowly tested ACF and for me it was far greater tool.

  • Also having lots of problems with ACF PRO 5.0.x and WPML 3.1.6

    Something seems to be fundamentally broken. I tried a lot of things, hacked the ACF and WPML files to generate debug-output etc. but I can’t track down the real problem. Behaviour seems to change even with activation order of ACF and WPML plugins and/or other weird requirements.

    Some fields are obviously not saved if they do not exist in corresponding translated fieldgroup (weird), at the moment a simple field in a 1-field fieldgroup can not be changed any more, etc.

    From reading the WPML support forum it seems that they try to sell their “Types” plugin [#1, #2, #3, ..] as a working alternative instead of support.

    As I already bought ACF PRO 5 for a customer, I would really like to use it, invested a lot of time already, but probably now have to look at “Types” as well. 🙁

  • This is super weird… if I change the CPT-post to “Pending Review” or “Draft” in the Quick Edit options, then edit the page, it accepts and saves the data if I “Save as Pending” (doesn’t work if I hit Publish). Then I can set the status back to “Published” from the Quick Edit panel and the updated data shows up.

  • alright. i managed it! i use a function to upload the image to the media list first:
    http://goldenapplesdesign.com/2010/07/03/front-end-file-uploads-in-wordpress/

    i read the existing rows first and then use the attachment id from the function above:

    <form action="<?php the_permalink(); ?>" method="POST" enctype="multipart/form-data">
    	<input type="file" name="imageupload"/>
    	<input type="hidden" name="userid" value="<?php echo $current_user->ID;?>" />
    	<input type="hidden" name="username" value="<?php echo $current_user->display_name;?>" />
    	<input type="submit"/>
    </form>
    <?php
    	foreach ($_FILES as $file => $array) {
    		$image = insert_attachment($file,$post->ID); //upload image and returns the id
    	}
    	if( have_rows('galerie') ){
    		$gallery = get_field( 'gallery' );
    	} else {
    		$gallery = array();
    	}
    	
    	// add to existing array
    	$gallery[] = array(
    		'bild'			=> $image,
    		'nutzerid'		=> $_POST["userid"],
    		'nutzername'	=> $_POST["username"],
    		'freigeben'		=> ""
    	);
    	// save new array
    	update_field("field_53e0e20e2cc16", $gallery, $post->ID);
    ?>

    you can see my acf setup in the attachment. maybe someone has ideas to simply things?!

  • I just ran into the same issue as truheart. However, I utilized WP_Query in my loop to call my custom post type. My code is similar to:

    $args = array( 'post_type' => 'customposttype' );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();

    In this case, I found the way to reset the post data was to run:
    $loop->reset_postdata(); instead of wp_reset_postdata(); (due to the fact I have no global $post object defined).

  • Here is a another summary if the first writeup is difficult to understand:

    Basically what I need is a way to change the name input of a custom field depending on the post that is being edited.

    So if we are editing a post that has a URL like this:
    http://inboundsoon.dev/wp-admin/post.php?post=95897&action=edit&variation=2

    Then I need to modify the ACF saved name input to have -2 on the end of it.

    And when the same page loads it needs to detect that it needs to populate custom field values from the values stored with -2 in the name key.

  • I was just about to ask the same thing. According to v5 features:

    The .json files can also be used on other websites even if the field group does not exist in the database. This allows you to create fields on your local website, commit the updated or new .json files and push them to your live website.

    I’ve just set up my project on staging and after activating ACF and the theme with JSON configs, I’d expect fields to auto-apply but they didn’t.

    Is there a bug or am I misunderstanding this feature?

  • got it (it is explained here: http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/ and here is the user_query explained: http://codex.wordpress.org/Class_Reference/WP_User_Query):

    <?php  
    // args
    $args = array(						
    'meta_query' => array(
    'relation' => 'OR',
    array(
    'key' => 'country',
    'value' => 'germany',
    'compare' => 'LIKE'
    )
    )
    );
    
    // The Query
    $user_query = new WP_User_Query( $args );
    
    // User Loop
    if ( ! empty( $user_query->results ) ) {
    foreach ( $user_query->results as $user ) {
    echo '<p>' . $user->display_name . '</p>';
    }
    } else {
    echo 'No users found.';
    }
    ?>
    
    <?php 
    // aaaaaand reset ...
    wp_reset_query(); 
    ?>
  • Exactly! I found myself having to refresh because of a mis-click one too many times. Hence my humble request. =)

  • Is this something like what you are seeing? a:1:{i:0;s:1:"1";}
    That is an array of user IDs in serialized format. In this case an array with one element. To get this you can convert using something like:
    <?php serialize(array($user_id)); ?>

  • I actually solved this issue. Instead of the Relationship field, I used a Repeater field / Post Object combination, where I set min-max row counts to 4, and then made the Post object fields required. If no post is chosen, it just defaults to the most recent post/default selected option on the Post Object field (as long as you don’t choose “Allow Null” as an option)

  • From the devs over at Relevanssi:

    For some reason, the query seems like a search so that Relevanssi catches it, and since it’s not a search, it’s missing critical parameters and Relevanssi is complaining.

    Can you make that AJAX request look less like a search? Can you show me the code?

Viewing 25 results - 17,976 through 18,000 (of 21,318 total)