Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

topic

  • Unread

    Repeater field not displaying

    Hi, I can’t seem to be able to display the repeater field and would love to understand why. All help is much appreciated! This is the code I’m using:

    <div class="infusion-ingredientes-iconos">
    <?php if ( have rows ('infu_ingredientes_iconos') ) : ?>
    <ul>
    <?php while( have_rows ('infu_ingredientes_iconos') ) : the_row(); ?>
    <img src="<?php get_sub_field('infu_ing_icono');?>" />
    <div>
    «span class="infu-ing-titulo"><?php get_sub_field('infu_ing_titulo');?></span>
    <a href="<?php get_sub_field('infu_ing_link' );?>"><?php get_sub_field('infu_ing_btn');?></a>
    </div>
    <?php endwhile; ?>
    <?php endif: ?>
  • Solving

    Query by an array of values from an ACF repeater Post Object sub field

    I am building a record label website in WordPress which has an artists and a releases post type.

    The first part of my issue is as follows: I have a repeater field in releases called release_artist, containing a post object sub field called artist. I need to extract an array of post IDs from that sub field (sometimes a release has more than one artist associated).

    For example:
    Row 1: Artist = XXX (post ID 1)
    Row 2: Artist = YYY (post ID 2)

    The result I want to extract as a variable would in this case be the array 1,2.

    This is my attempt so far at extracting that array as a variable:

    
    if(have_rows('release_artist')): 
        while(have_rows('release_artist')): the_row();
            $select = get_sub_field_object('artist');
            $value = get_sub_field('artist');
            $artists = $select['value'];
        endwhile; 
        $artists_id = $artists->ID; // this should be an ID if only 1 repeater row, or array of IDs if more than 1
    else: endif;
    

    It’s returning only the ID of the sub field from the last repeater row.

    The second part of my issue is this: I then need to use this array in a query to find other releases posts that have one or more of the artist(s) associated. So far I have the following, which is also currently wrong:

    
    $artist_release_args = array(
        'post_type'     => 'releases',
        'meta_query'    => array(
            array(
                'key'       => 'release_artist_artist',
                'value'     => $artist_id, // this should give only results with one of the post IDs present in the array
                'compare'   => '='
            )
        ),
        'showposts'     => 6,
        'order'         => 'DESC',
        'post__not_in'  => array($post->ID),
    );
    
    $artist_release_query = new WP_Query($artist_release_args);
    

    I’m pretty sure that meta_query is wrong, but I’m really not sure how to fix it.

    In short:
    Q1: How do I extract the desired array of post IDs from the repeater field?
    Q2: How can I correctly compare this array against post IDs in the query?

    I’m running WordPress 6.4.3 and ACF Pro 6.2.7 in a local environment.

  • Unread

    Update Select data field on change Relationship field

    Good morning

    I’m looking for a little help here for a particular request…for which I can’t find a solution.

    I’m looking to update a Select field when I change the value of a Relationship field.

    My Relationship Field includes products from my WooCommerce and I only authorize a selection. (I didn’t do a loop)

    My script for the select field works. In fact I would like to be able to launch the PHP update of this field from my JS
    .on('DOMSubtreeModified', function()
    But I do not know how…

    Here is my complete script (JS and PHP) in my function.php file

    function my_acf_input_admin_footer() {
    ?>
    acf.add_action('ready', function( $el ){ // $el will be equivalent to $('body') // var $field = jQuery('.acf-field-65d324bb8637b');
    
    jQuery('.acf-field-65d324bb8637b ul.values-list').on('DOMSubtreeModified', function(){ console.log('changed'); });
    
    });
    <?php } add_action('acf/input/admin_footer', 'my_acf_input_admin_footer'); // Fonction champ couleur function acf_load_product_variations( $field ) { // Reset du champ Select $field['choices'] = array(); // Récupération des infos "PRODUIT" $produit = get_field( 'produit'); // Si champ "PRODUIT" - UPDATE du
    if($produit):
    
    $product_id = $produit["0"]->ID;
    $product = wc_get_product( $product_id );
    $variation_ids = $product->get_children();
    
    if ( $variation_ids ) :
    
    foreach ( $variation_ids as &$variation ) :
    
    $product = new WC_Product_Variation($variation);
    $attributes = $product->get_attributes();
    $data_array = array();
    
    if( $attributes ){
    foreach ( $attributes as $meta_key => $meta ) {
    $display_key = wc_attribute_label( $meta_key, $product );
    $display_value = $product->get_attribute($meta_key);
    #$data_array[] = $display_key .' : '. $display_value;
    $label = $display_value;
    
    }
    }
    #echo implode( '
    ', $data_array ) . '
    ';
    // Les variables
    $value = $variation;
    // $label = $produitName;
    // Ajout au Select
    $field['choices'][$value] = $label;
    
    endforeach;
    
    endif;
    
    endif;
    
    // Return the field
    return $field;
    
    }
    
    add_filter('acf/load_field/name=color_product', 'acf_load_product_variations');
    

    If anyone has an idea or has already encountered this problem, I’m interested!

    Thanks for your help 🙂

  • Unread

    Add Anchor link set button open on the same page

    I was trying to implement these actions below;
    1) ‘Join Now’ button to jump on-page to ‘SLT UWS FOUNDER’S MEMBERSHIPS’ section
    2) ‘Sign Up’ button to jump on-page to ‘GET ON THE VIP LIST’
    3) ‘Join Now’ button (2nd button) to jump on-page to ‘GET ON THE VIP LIST’

    This is the link https://sltnyc.com/slt-uws/

    My question how can I add an anchor link and set the button to open on the same page, not on the new tab, is there a quicker way to do this? Appreciate any help.

    Thanks.

  • Solved

    Unable to update ACF Pro from 6.2.3 > 6.2.7

    Tried manually in multiple environments and via WP Engine’s Smart Plugin Manager.

    Getting the following error:

    Uncaught Error: Call to undefined function acf_register_plugin_update() in [path]/wp-content/plugins/advanced-custom-fields-pro/pro/updates.php:38 Stack trace:
    #0 [path]/wp-includes/class-wp-hook.php(324): acf_pro_updates->init(”)
    #1 [path]/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #2 [path]/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #3 [path]/wp-settings.php(643): do_action(‘init’)
    #4 [path]/wp-config.php(129): require_once(‘/nas/content/li…’)
    #5 [path]/wp-load.php(50): require_once(‘/nas/content/li…’)
    #6 [path]/wp-admin/admin-ajax.php(22): require_once(‘/nas/content/li…’)
    #7 {main} thrown on line 38 in file wp-content/plugins/advanced-custom-fields-pro/pro/updates.php

    Any ideas?

  • Unread

    Filter User Query Post

    I have created an ACF post type called “Dashboard” which has a field for user selection called “usersacf”.

    I need to show the post called “Dashboard” only to the user who enters from the “usersacf” field. This is the query ID I used. But not working. It is designed in Elementor.

    function my_post_object_query( $args )
    {
    $args[‘author’] = get_current_user_id();

    return $args;
    }
    add_filter(‘acf/fields/post_object/query/name=usersacf’, ‘my_post_object_query’);

  • Solved

    ACF Link rel=”nofollow” possible?

    Hi there,

    I created a link field. According to the documentation (https://www.advancedcustomfields.com/resources/link/) you can set up link text, link target, and target.

    Question: Is it possible to set up the rel too?

    Best
    WaveToaster

  • Helping

    Repeaters – Get Sub-Field Siblings

    Hi 🙂

    So, I’m trying to use ACF Repeater fields to make a rudimentary translation system but I’m failing on something that feels like it should be easy. I’ve searched but to no avail.

    Each Page already has English content and each Page can have multiple translations, which may or may not be different per page.

    I have created a repeater field (called ‘page_translations’). This repeater field has 3 sub-fields:

    1. A select dropdown where a user can choose a language to translate to (called ‘choose_language’). The value of each <option> field is a two letter country code (e.g ‘fr’ for french)
    2. A text field to enter the Page title in the new language (called ‘translated_title’)
    3. A WYSIWYG editor field to enter the Page content in the new language (called ‘translated_content’)

    So, if an author wanted to add a French translation of a Page, they’d click the repeater button under the English content, specify French as the language then add the title and content in French. If they wanted another language too, they’d click the repeater button again and repeat the process for the new language.

    I intend to re-load each Page that has translations via a clickable URL with &tr=fr (‘fr’ is french in this example) appended to each link.

    What I was planning to do was detect if tr is set and has a value. If not, display English but if it has then pull out the translated title and content.

    I assumed ACF Repeater functions would include a ‘sibling’ call e.g. if tr equals fr get the two siblings associated with that repeater (title and content). But it seems I was wrong.

    Is there something obvious I’m missing here? If no, is there a way I can get to the siblings of the chosen language?

  • Unread

    Getting value of a custom field in a custom taxonomy

    Hi,
    I have created a custom post type “Stories” where I’ve also created a custom taxonomy named “Segment”. Connected to this custom taxonomy I’ve created a custom field “segment_image” (set to array) ruled to be shown if Taxonomy is equal to “Segment”. The idea is that each term will have an image assigned and will be displayed in the post depending on the segment chosen.

    In the back-end everything seems to be connected correctly and the field is showing in the Taxonomy page to upload an image. The problem I’m having is that I can’t find the way to retrieve that image ID or URL in my template page.

    Here is my code:


    <?php
    $args = array(
    'post_type' => 'stories',
    'post_status' => 'publish',
    'posts_per_page' => -1
    );

    $loop = new WP_Query( $args );

    while ( $loop->have_posts() ) : $loop->the_post();

    $segment = get_field('segment_story');
    $segment_bg = get_field('segment_image', $segment);

    echo 'bg: ' . $segment_bg['url'];

    I’ve even created a Taxonomy field type in my custom post type “Stories” called “segment_story” to force getting the term array manually but still nothing.

    I would appreciate any help with this! I’ve checked several ACF documentation pages and also checked some threads here but nothing worked for me so far.

    Thanks in advance!
    I.

  • Unread

    Dynamic Accordion from Heading and Paragraph Tags

    I have one challenge that is confusing my head a little.

    If you look at this Page– https://prnt.sc/M9JDeuRYgyzY

    You will see that it has an Accordion, but we need this Accordion to show Dynamic Content pulled from Post Content.

    So that all Headings within a particular part of the Post Body will be a new Accordion Heading, and all contents below that Heading will form the Accordion Content.

    HOW IT IS SET UP
    I will create a Container, and give it a Class Name of “Post Content”.

    Inside that container, will be an ACF WYSIWYG Editor.

    WHAT IS INTENDED
    I want a code that would help me loop through the ACF WYSIWYG Editor, and pull out all the Headings(H1 to H6) and all Paragraph Text Contents within the WYSIWYG Editor.

    OUTCOME EXPECTED
    All information within this container and WYSIWYG editor needs to be displayed on the frontend as an Accordion dynamically.

    All Headings within this container and WYSIWYG editor will become each Accordion Heading, and all contents below each Heading in this WYSIWYG Editor will be the Accordion Content of each Accordion Heading.

    Example:

    In the container and WYSIWYG Editor, Heading 1 is “What is Product Management”. Then it has contents below it.

    Heading 2 in the container and WYSIWYG Editor is “Product Research”. Then it has contents below it.

    QUESTION
    How can I create a Dynamic Accordion with ACF– which will display every Heading within the specified container, as an Accordion Heading, and the Content below that Heading as the corresponding Content, in a dynamic way: such that the number of Accordion Headings and contents per Post, will be according to the Headings and contents within the specified container in the Post?

    MY THINKING
    You see, I don’t think it is possible to achieve such Dynamic Accordion in this life.

    But at the same time, such statement could be my ignorance talking :blush:

    REQUEST
    Please, if you have any smart way to achieve this with ACF, Please educate me on it.

    2.) Also show me how to make this outcome a Shortcode that I can paste anywhere on my Post or Pages.

    Needing to hear from you soon.

    Regards.

  • Solved

    Dispalay ACF values in alphabetical order

    I have a loop displaing all values of a specific field in a custom template page. This avoid to repeat same values twice or more and works fine.
    My goal is to display values in alphabetical order. How I can do it?
    Thanks in advance.

    
    <div class="prod-company-items">
    
    <?php
            $args = array(
              'post_type' => 'credits',
              'posts_per_page' => -1,
            );
    
            // La Query
            $kc_query_companies = new WP_Query( $args );
            $kc_productions = array();
    
            // the Loop
            while ( $kc_query_companies->have_posts() ) :
              $kc_query_companies->the_post();
              $kc_productions[] = get_field('production_company'); ?>
            <?php endwhile;
    
            $kc_productions = array_unique( $kc_productions );
    
            foreach ( $kc_productions as $kc_production ) { ?>
              <p class="prod-company-item">
                <?php echo $kc_production; ?>
              </p>
            <?php }
    
            // Reset Query & Post Data
            wp_reset_query();
            wp_reset_postdata(); ?>
          </div>
    
  • Unread

    Show all posts from CPT into single specific post and add values with ACF

    Hello,

    I’m encountering an issue that I hope to resolve using ACF.

    I have two custom post types: People and Questions.

    My goal is to display all (posts from) questions for each individual person in the WordPress backend. Allowing me to enter answers (via ACF) for each question. This way, I can fill in the entire list of questions specifically for each person.

    Can I use ACF PRO to achieve this?

  • Solved

    Programmatically set the value of a select2 field.

    Working with a front-end form, I want to programmatically set the value of a select2 taxonomy field after another field is updated.

    I have tried all manner of updating the value but it either doesn’t change or gets set to null. Any ideas? I thought I had a very simple task at hand, but its eluding me.

    This is what I have tried:

    
    const selectedValue = 12; //the id of the term I want to select
    $('#acf-field_5dcc4aa906709').val(selectedValue).trigger("change"); 
    
    var countyfield = acf.get_field('field_5dcc4aa906709');
    countyfield.val(selectedValue); 
    

    The first one should work according to the select2 documentation. This actually sets the value of the field to null.

    The second one I got from the ACF documentation. This updates the field object but does not update the field in the UI.

  • Unread

    Add Image for Menu Item

    I need to add image for item menu element. I used this documentation that create own code.

    
    add_filter('wp_nav_menu_objects', 'my_wp_nav_menu_objects', 10, 2);
    function my_wp_nav_menu_objects($items, $args) {
        foreach ($items as &$item) {
            $icon = get_field('image_icon', $item);
    
            if ($icon !== false) {
                $icon_url = $icon['url'];
                $icon_alt = $icon['alt'];
                $icon_html = '<div class="decor-block_wrapper"><img src="' . esc_url($icon_url) . '" alt="' . esc_attr($icon_alt) . '" /></div>';
                $item->title = $icon_html . '<a>url . '">' . $item->title . '</a>';
            }
        }
        return $items;
    }
    

    But I got into tag . How to add image before tag without link ? I need something like this

    
    <li>
        <div><img src="" /></div>
        <a href="">Item</a>
     </li>
    

    But now my code criated like this

    
    <li>
        <a href=""><div><img src="" /></div></a>
        <a href="">Item</a>
     </li>
    

  • Helping

    Watch out for cache issues with the oEmbed field

    Hi there! One of my websites was blocked recently by vimeo due to too many requests to their oEmbed endpoint. I investigated this and realized that the ACF oEmbed field I was using on the website was re-requesting their endpoint over and over, without making use of WP’s built-in oEmbed cache. I found this related topic on the forums and tried out the solution provided by @Chauncey McAskill. I then realized that it only worked when requesting the videos on a single post screen. I opted vor overwriting $wp_rewrite->post_ID to fix this.

    Since that post is closed to new replies, I’m posting my full solution here, as reference for others and my future self.

    One could almost argue that this is a bug, so I’ll go ahead and mark it as one – even though there is the attached workaround.


    <?php

    /*
    * Copyright (c) Rasso Hilber
    * https://rassohilber.com
    */

    /**
    * This class helps with caching ACF oEmbed fields
    * @see https://support.advancedcustomfields.com/forums/topic/oembed-cache/
    */

    namespace RH\AdminUtils;

    if (!defined('ABSPATH')) exit; // Exit if accessed directly

    class ACFOembedCache
    {
    /** Init */
    public static function init()
    {
    add_action('acf/init', [__CLASS__, 'disable_default_oembed_format_value'], 1);
    add_filter('acf/format_value/type=oembed', [__CLASS__, 'format_value_oembed'], 10, 3);
    add_filter('acf/update_value/type=oembed', [__CLASS__, 'cache_value_oembed'], 10, 3);
    }

    /** Disables the built-in formatting for oembed fields */
    public static function disable_default_oembed_format_value(): void
    {
    $field_type = acf_get_field_type('oembed');
    remove_filter('acf/format_value/type=oembed', [ $field_type, 'format_value' ]);
    }

    /** Fetch the cached oEmbed HTML; Replaces the original method */
    public static function format_value_oembed($value, $post_id, $field)
    {
    if (empty($value)) return $value;

    return self::acf_oembed_get($value, $post_id, $field);
    }

    /** Cache the oEmbed HTML */
    public static function cache_value_oembed($value, $post_id, $field)
    {
    if (empty($value)) return $value;

    // Warm the cache
    self::acf_oembed_get($value, $post_id, $field);

    return $value;
    }

    /**
    * Attempts to fetch the embed HTML for a provided URL using oEmbed.
    *
    * Checks for a cached result (stored as custom post or in the post meta).
    *
    * @see \WP_Embed::shortcode()
    *
    * @param mixed $value The URL to cache.
    * @param integer $post_id The post ID to save against.
    * @param array $field The field structure.
    * @return string|null The embed HTML on success, otherwise the original URL.
    */
    private static function acf_oembed_get(mixed $value, string|int $post_id, array $field): string|false|null
    {
    if (empty($value)) return $value;

    /** @var \WP_Embed $wp_embed */
    global $wp_embed;

    $attr = [
    'width' => $field['width'],
    'height' => $field['height'],
    ];

    remove_filter('embed_oembed_html', 'Roots\\Soil\\CleanUp\\embed_wrap');

    /**
    * Overwrite $wp_embed->post_ID with the field's $post_id (if it's an integer)
    */
    $__wp_embed_post_id = $wp_embed->post_ID;
    if (is_int($post_id)) $wp_embed->post_ID = $post_id;

    $html = $wp_embed->shortcode($attr, $value);

    /** Reset $wp_embed->post_ID to it's previous value */
    $wp_embed->post_ID = $__wp_embed_post_id;

    add_filter('embed_oembed_html', 'Roots\\Soil\\CleanUp\\embed_wrap');

    return $html ?: $value;
    }
    }

  • Unread

    using get_field() to find a user_email ?

    is it possible to use get_field() to get the email of a user ?

    I cannot make it work : get_fiel("user_email", "user_".$user_id) returns null, and get_fields("user_".$user_id) returns an object that does not contains the field user_email

    however, using the wp function get_userdata($user_id)->data->user_email) give me the right result

    Maybe get_field() only works for acf fields ? that would make sense, but in the other hand the documentation page says ‘this function can be used to load the value of any field from any location’ https://www.advancedcustomfields.com/resources/get_field/

    I wanted to use get_field() because it was easier to have only one way to do it, otherwise I should check if the field is an acf field before maybe ? How can i do that ? Simply if get_field() returns null ?

    And also, I was wondering if get_field() was maybe more secure than get_userdata() ?

  • Unread

    Using ACF Pro in own plugin: free version issue and updates.

    Hello

    I’ve prepared a small plugin that utilizes ACF Pro, mainly because of the options page and repeater. This is not a plugin intended for sale, but for my clients’ websites, where I already use ACF Pro in most cases. I placed the plugin in the my plugin directory, and additionally, in the options, I added a switch that shows/hides ACF in the dashboard menu. In connection with this, I have a few questions:

    1. If I hide ACF Pro from my plugin and install the free version, the options page disappears. Is it possible to avoid this so that the options page is always visible?

    2. What about automatic plugin updates in my plugin? I understand that I should do this manually, correct?

    Thank you 🙂

  • Solving

    Media Library Field not visible on front-end

    Hi,

    This is an important issue for all website builders. Image rights agencies nowadays scour the web looking for stock photos/images whose copyright notice has not been published according to the proper rules and then present them with a hefty bill.

    So it is more important than ever to have a correct copyright notice with the photos on your website. Unfortunately, the WordPress Media Library does not provide a field for this. You can add it quite easily with ACF and link it to the Media Library with the rule ‘Attachment > all image formats.’ If only it would works so easily.

    On a website I’m building in Divi (one of the builders supporting ACF), I did this to be able to automatically show the photographer and stock photo platform in the front end for featured images.

    In the template for displaying posts, I have added a text module with the ACF Copyright field as content (Divi is one of the website builders supported by ACF).

    When I create a post, the design of this template is automatically applied. However, the content of the Copyright field is not displayed. Am I overlooking something?

    Kind regards,
    Pierre Gielen

  • Solving

    Auto-populate Custom Post Excerpt with one or multiple Custom Field(s)

    Hi, i need to auto-populate custom post excerpt with a custom field,
    (probably with multiple fields but if i can see how to populate with one i am confident i can manage adding multiple fields)

    I need all posts to automatically contain their unique custom_field value in their excerpts.

    I have had multiple attempts but nothing worked so far.

    need a simple php function to add to functions.php

    GPT4 gave me this but did not work. In case it helps you help me;

    function update_custom_post_excerpt_with_custom_field( $post_id ) {
        // Check if this is a post of your custom post type and not an autosave.
        if ( get_post_type( $post_id ) === 'your_custom_post_type' && ! wp_is_post_autosave( $post_id ) && ! wp_is_post_revision( $post_id ) ) {
            // Get the value of the custom field.
            $custom_field_value = get_post_meta( $post_id, 'watercraft_stock_number', true );
    
            // Check if the custom field value is not empty.
            if ( ! empty( $custom_field_value ) ) {
                // Prepare an array to update the post excerpt.
                $post_data = array(
                    'ID'           => $post_id,
                    'post_excerpt' => $custom_field_value,
                );
    
                // Update the post excerpt without triggering an infinite loop.
                remove_action( 'save_post', 'update_custom_post_excerpt_with_custom_field' );
                wp_update_post( $post_data );
                add_action( 'save_post', 'update_custom_post_excerpt_with_custom_field' );
            }
        }
    }
    
    // Hook into the save_post action.
    add_action( 'save_post', 'update_custom_post_excerpt_with_custom_field' );

    (my first topic flagged as spam while i was editing it, had to open another one)

  • Solving

    Live field value

    This might be a daft question, is there a way to display a live value on a page.

    For example I have the field ‘status’, is there a way of displaying the live value without refreshing the page. So if a user updates this on the back end, the front end user sees the updated value without refreshing the page.

    Alternatively if not possible and someone updates a specific field it forces a refresh on the front end.

    Hope this makes sense, and any pointers greatly appreciated.

  • Solved

    Sort by post category and then by date

    All posts have categories and dates.
    I want to sort them by categories (meta-value), which are strings.
    Afterwards, I want to sort them by year (meta-value-num).

    This is what I have now:

    <?php
    $allPosts = new WP_Query(array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘intervention’,
    ‘orderby’ => ‘meta_value’,
    ‘meta_key’ => ‘publication_category’,
    ‘order’ => ‘ASC’
    ));

    while($allPosts->have_posts()){
    $allPosts->the_post();

    //Display posts ordered by category and inside categories organise by dates

    }
    ?>

    How can I solve this?
    Thanks to the community!

Sort by post category and then by date

  • Unread

    Rules and affiliate program

    Hey there people, I hope that everyone is doing great, this is the issue people I have problems with appear with the rules I need to make up just one field group in just one type of post on a certain page but when I go to the Elementor Pro dynamic tags to select the fields about the ACF appears every single field like I didn’t make any rule before, and not exactly the only one I am in the rules to see as you can see, I put it like (page is equal to inicio or home). At this moment and the rests the rules to exclude the rest of the page’s example page are not equal to About Us, so that is my first question how do I make the rules apply correctly according to the page I need to do it, or that type of rules more accurate could be for something like relationship terms to put a limit on the field group in obviously not the free version if not in the paid version. Secondly, is there any way to get an ACF affiliate program or there is no way, greetings.

    Best regards
    Daniel

  • Unread

    Use ACF Field value in a WP_Query

    Hi,

    So I’m looking to edit a query and have the items output, by alphabetical order, based on a ACF Field I’ve created.

    Here is the query as it stands:

          <?php $term_args = array(
              'post_type' => 'people',
              'posts_per_page' => -1,
              'tax_query' => $tax_query,
              'orderby' => 'title',
           );
           if (isset($s) && $s != '') {
              $term_args['s'] = $s;
          }
          $term_query = new WP_query($term_args);>

    This currently shows based on the page title, from A-Z, as expected.

    Within the custom post type People, I have a field for Surname, which I want to use to show the order from, again from A-Z. I’ve found other examples on here, but they seem to use a date field in ACF, and not a title, so I can’t really apply what I need.

    Is what I’m looking to achieve possible?

    Thanks,

  • Helping

    Show all posts WITHOUT relationship link to specific posts

    I’m trying to create a custom query in my template file that shows all posts that are by any other author than the ones I specify. It’s set up to do the query against an ACF Relationship field that connects an author with a post. I have reworked this from a custom query that shows all posts by a specific author. That one works as desired, but my “all posts by anyone else” query does not.

    Can anyone help me sort this out?

    
    /*
      Show all posts WITHOUT relationship link to specific posts
    */
    
    $authorID1 = 128; // First Author
    $authorID2 = 126; // Second Author
    
    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    
    $thePosts = new WP_Query(array(
    	'post_type'        => 'post',
    	'posts_per_page'   => 10,
    	'meta_query' => array(
    		'relation' => 'OR', // Use 'OR' for posts matching either author ID
    		array(
    			'key' => 'author',
    			'value' => $authorID1,
    			'compare' => 'NOT LIKE',
    		),
    		array(
    			'key' => 'author',
    			'value' => $authorID2,
    			'compare' => 'NOT LIKE',
    		),
    	),
    	'order' => 'DESC',
    	'orderby' => 'date',
    	'post_status' => 'publish',
    	'paged' => $paged,
    )); 
    
  • Unread

    FSE templates settings panel

    template panels: part of the theme options pages that were controlling a specific template eg . the template of a single course template or author page etc

    In the classic themes we were using the redux or plugins like ACF to create panels to control the template options

    now in FSE with Gutenberg, we have a tab in the right sidebar (which contains two tabs one for the block control which is now the ACF but its’ form, and the other tab that shows the info of the current template )

    So what I suggest: ACF enables us to create a form in this tab, so we can use this setting in our blocks as a general/global settings

    imagine you open a template
    and you set its settings in the live editor, add its components in the live editor
    imagine how much we can use this in creating advanced themes with good and easy control without leaving everything to the end user ( who doesn’t want to make a lot of choices and always wants it as simple as possible )
    it will be a mix of all the advantages of classic customizer + Gutenberg FSE and old theme panels 🙂 WOW

    screenshot of classic theme panels: https://prnt.sc/uFISqlsWyF7-
    screenshot of the current FSE template panel sample: https://prnt.sc/Ec40KKSiEY4Y
    screenshot of the place I think it’s ideal: https://prnt.sc/X9sSAbOmrPiZ

Viewing 25 results - 251 through 275 (of 21,345 total)