Support

Account

Forum Replies Created

  • You can get the published date with something like:

    $publishDate = get_the_time('F d, Y', $featured_post->ID);

    Change the format there, as needed. You’re getting the error on categories because of how you’re trying to spit out the $categories variable.

    $categories will be an array of categories so to display them, you’d want to loop through the array. I don’t know what you want from the category (a link to the category, just the name, etc.) but it’d be something like:

    foreach( $categories as $category ) {
        echo $category->name;
    }
  • For this filter:

    add_filter( 'gform_notification_55', 'acf_email', 10, 3);
    function acf_email ($notification, $form, $entry){
      $post_id = rgar($entry, '14');
      $notification['to'] = get_field('staff_email', $post_id);
      return $notification;
    }

    Notification was misspelled in the returning line (‘notificaiton’). There is also a misspelling of it in two places on the second filter tried, but I think that one has other problems, as well.

    Beyond making sure there is no typo in notification throughout any given filter used, I’d verify:
    1) 55 is the correct form ID of the form you’re trying to modify this on
    2) 14 is the correct ID of the field that the post ID you’re passing to this form is located inside of.

  • I would recommend also adding a check that the snippet is only impacting the main page query so this line:

    if ( $query->is_front_page ) {

    Would change to:

    if ( $query->is_main_query() && $query->is_front_page() ) {

  • Ohhhhh, you’re wanting it in conditional logic, not as a location rule on an overall field group. You can definitely assign field groups based on if an item is given a certain taxonomy term so you could say display this set of fields if the taxonomy term for admissions is equal to free or equal to paid. It’s just something that has to be done in separate sets of fields.

  • You should see taxonomy terms able to be selected like this if you choose Post Taxonomy as the first rule dropdown.

  • Taxonomies aren’t children of one another. Taxonomy terms can be hierarchical to where they can have parent/child relationships (like categories.)

    When registering a taxonomy, you just make sure the hierarchical toggle is on if that’s what you want. If it’s not on, the terms cannot have parent/child relationships and be nested. If hierarchical is on, they can be and when you go to create terms in that taxonomy, you should see the ability to set an existing term within that taxonomy as the parent.

  • It looks like they changed the default post status to “any” for post object, relationship, and page link fields in ACF Pro 6.1.4 so if you update, you should see your scheduled posts again.

  • Maybe check your field group reference? Try using the post ID of the field group. You can see it in the URL when editing the field group.

  • You could probably utilize the post object query filter and adjust it to look for a post_status of future in addition to the default publish.

    https://www.advancedcustomfields.com/resources/acf-fields-post_object-query/

    So it would be something like:

    add_filter('acf/fields/post_object/query', 'my_acf_fields_post_object_query', 10, 3);
    function my_acf_fields_post_object_query( $args, $field, $post_id ) {
    
        // Show scheduled posts, as well
        $args['post_status'] = array('publish','future');
    
        return $args;
    }
  • There’s no limitation coming from ACF but you could hit up against a max setting for PHP max_input_vars on your server or similar that could interfere.

  • The core columns block doesn’t use multiple innerblocks. The core columns block is just nested blocks so core/columns is a block and core/column is another block nested within it then blocks get further nested within the column block.

    Buttons work the same way core/buttons is a block and core/button is a block nested within it.

    For columns, you’d probably be better off trying to utilize the core/columns block and set it up with a innerblocks template that uses it vs. creating your own columns in ACF but there may be a reason you’re avoiding use of the core block. It’s just “backing up” your idea of where InnerBlocks would start and enveloping the container in it and working off the nested block concept vs. framing it as any block-based area would be its own innerblocks area. Not sure if this helps or just makes things worse haha

  • Try incorporating get_block_wrapper_attributes() into your ACF block’s container. It should take the values you’re setting via the controls and add the appropriate styles and classes for it.

    It took me way too long to find that function and I was equally annoyed and writing overly complex custom conversion functions to work off the values as I didn’t know there was a better way.

  • You can adjust it to use an OR operator by something like:

    <?php if( have_rows('resources') ): while( have_rows('resources') ) : the_row();
    $colors = get_sub_field('show_for');
    if( !empty($colors) && ( in_array('usersme', $colors) || in_array('other_value', $colors) ) { ?>
     TEST
    <?php } endwhile; endif; ?>
  • For your variations where everything is blank, did you adjust the return value of the checkbox field? By default, ACF checkbox fields return the value only so if you’re wanting to return an array with both the label and the value and use one for the color and one for the text, you’d want to change the return value to return both. If you don’t, it’d result in neither value nor label returning anything.

  • You can do this with a block template. So in your theme’s functions file, you could set it up using something like:

    function yourprefix_register_page_block_template() {
        $post_type_object = get_post_type_object( 'page' );
        $post_type_object->template = array(
            array( 'acf/hero' ), // may need to adjust this based on block name
        );
    }
    add_action( 'init', 'yourprefix_register_page_block_template' );

    You can also do it with JS, the link above for block templates goes into how.

  • This is what you need:

    https://github.com/AdvancedCustomFields/acf/blob/master/includes/locations/class-acf-location-page-parent.php

    It allows you to specify an exact page parent (Parent XYZ) in your case. You can create a field group, select to show if Page Parent = Parent XYZ.

    I’ve had pro for so long I just don’t remember what isn’t in the free version so I suggested if you don’t see Page Parent, it could just be in the pro version, but that’s the rule that does the exact thing you’re asking for. The fact it’s in the repo for the free version suggests it isn’t a pro-only feature. I’d double-check your location rules. Best of luck!

  • The pro version solves your problem so other than telling you, “Buy the pro version if you need the pro functionality” or write your own location rule, not sure what answer you’re looking for. ACF Pro solves your problem, sounds like you just aren’t willing to buy it haha.

  • There is most definitely a Page Parent location rule that allows you to select a specific parent page location rule for a field group but it may be a location rule only available in the Pro version.

  • Haven’t tested this but I’d look at your loop where you’re going through the user IDs. The first $output declaration is just:

    $output = '<div class="bp-user-profile">';

    Which would be fine if it was a single loop through it but every subsequent loop I think would get messed up by this, so the returned ID is maybe the last one in your field? It may be as simple as changing it to:

    $output .= '<div class="bp-user-profile">';

  • Most people who are using ACF are also customizing themes or building custom themes so they’re often using a code editor independently of WordPress. There’s a billion ways to build in WordPress so what theme you’re using, whether you’re using a page builder or not, whether you’re using the block editor or still using classic, specific plugins, etc. beyond just your skill (beginner vs advanced user) all factors in to what is the best or “easiest” way.

    If you don’t want to edit code, I’d look at displaying ACF using a shortcode: https://www.advancedcustomfields.com/resources/shortcode/

    Depending on what you’re using, there could be a better way as many, many tools integrate with ACF.

  • You should see a Page Parent location rule in the Pages section when adding a field group.

  • What is background_image set to return as? If it’s set to return an array, what you need in for the way you’re using it in the example is the URL. Depending on what size you’re trying to pull, what that looks like changes but it’d likely be something comparable to:

    <?php $background = get_field('background_image'); ?>
    <div class="fullwidth-container" style="background-image: url(<?php echo $background['url']; ?>);">

    Instead of $background[‘url’], it may be something like $background[‘sizes’][‘large’] or comparable.

  • If you mean you can’t see the Custom Fields area in the menu, I would look in your theme’s functions.php file or search your theme code to see if you see a line that looks like this:

    add_filter('acf/settings/show_admin', '__return_false');

    This removes Custom Fields from the nav. But it shouldn’t block you from updating content or anything. All the custom fields menu item does is hide the admin area to modify field groups and fields within them. Not sure if that’s the issue.

  • The comparison is case sensitive so is “Do Not show” exactly what the string reads? (with Not capitalized and show not capitalized?)

  • Yes, you can do this. There are plugins that can assist like FacetWP, WP Gridbuilder, Search & Filter Pro, and others. Most WordPress filtering plugins integrate with ACF.

Viewing 25 posts - 1 through 25 (of 70 total)