Support

Account

Home Forums Search Search Results for 'q'

Search Results for 'q'

reply

  • It’s been 2 years since the question, howver I’d like to share my opinion 🙂

    Try to echo just $nomInfo[‘user_avatar’], it contains tag with all info. So the whole line <img src="<?php echo esc_attr($nomInfo['user_avatar']); ?>" alt="author-avatar" />
    will look just like <?php echo $nomInfo['user_avatar']; ?>
    It worked in my case which looks quite same.

  • No there isn’t, and it would be difficult to do so. You would need to parse the HTML in post_content to find the images and the image IDs added to the content preg_match_all() and a regular expression.

    Here is an example of an image inserted into content

    
    <img class="alignnone size-medium wp-image-140" src="http://domain.com/wp-content/uploads/2023/03/image.jpg" alt="" width="300" height="169" />
    

    you can see that in the class the image ID of “140” is included.

    This has not been tested, but something like might do it.

    
    preg_match_all('/wp-image-(\d+)/', $string, $matches);
    

    And you’re list of ID (as strings) would be found in $matches[1].

  • Slashes are added to input to escape values because that is how your server is configured. If you access the raw values of $_POST then you must strip them before using them to query the db.

    You are not inserting anything into the DB, you are looking for something that is already there. In addition to this WP sanitizes the values before when using WP_Query. This would only be a concern if you were directly querying the DB instead of using WP_Query. This is what the prepare() method of wpdb is for.

  • @hube2 I think it can be simplier than all that because ACF allows for simply a URL field right? So is there a way to add the image URL into that field and then reference it on the front end via some html+shortcode combination? The question really is can I generate an image using a url pulled from an ACF?

  • have ACF Pro installed on multiple sites without needing a license for multiple sites because of the way it currently works.

    Haven’t used elementor, but if the plan is to limit non-license usage on multiple apps, then why not follow what themes do? A license for a specific domain needs to be listed in the portal of the plugin/theme. All pro features available only on that domain.

    In the end, genuinely feels like being held hostage for ransom.

  • Thanks for the reply. I got the info directly from the FAQ at this link

    If the plugin intends to behave like this in the future it would be unpleasant. IMHO, If we pay for the current version we should be able to use that version. This feels like being held hostage for ransom lolz.

  • The most likely cause of this is that WP Sheet Editor is not compatible with ACF and is not saving the values for the image fields correctly.

    ACF image fields are saved in the DB as the image post ID. In addition to this, like all fields, ACF requires a field key reference in the DB.

  • I can tell you that this is currently not the case. All Pro features currently work even without an activation key entered as long as you have the Pro plugin installed.

    The information you quoted is not something I have seen before. The plugin has changed hands and either the new owners think this is how it works or they plan to make this change in the future.

  • @hube2 I’m really confuze. You said the plugin and all pro features will keep working unles wordpess makes ACF incompatible itself (assuming by chance).

    But the FAQ says:

    What is a license?
    License keys are used to activate the plugin via the ‘Updates’ ACF admin page. Activating the license key on a site enables automatic plugin updates and gives access to ACF PRO premium features.

    Until a valid license key has been activated for the site, it won’t be possible to create new or edit existing PRO fields (Gallery, Repeater, Flexible Content, or Clone), or use the premium features such as Options Pages and ACF Blocks.

    If you previously activated a license and the subscription has expired, you will not be able to create new PRO fields, but you will be able to edit existing PRO field definitions.

  • @hube2
    Thank you for your prompt response.

    screen shot
    This is a screenshot of the ACF select field settings (note that it includes Japanese text). The choices for this select field are automatically updated when a separate textarea is modified.

    As mentioned in my initial post, I am following the instructions provided here: ACF Guide on Dynamically Populating Select Fields.

    Regarding the code used for display, it is executed via the WordPress REST API. Below is a simplified version of the code. Please note that it may look odd due to simplification, but essentially, it’s just using get_field to retrieve data. Since the select field works correctly with choices that were initially present and after performing an export/import, I believe there is no bug in this code.

    
    <?php
    add_action('rest_api_init', function () {
        register_rest_route(
            'v1',
            'matches/(?P<slug>[a-z0-9_\-]+)',
            array('callback' => 'matchesResponse')
        );
    });
    
    function matchesResponse($request)
    {
        $post_args = [
            'name'              => $param_slug,
            'post_type'         => 'matches',
            'post_status'       => $request['post_status'],
            'posts_per_page'    => -1
        ];
    
        $post_query = new WP_Query($post_args);
    
        if ($post_query->have_posts()) :
    
            while ($post_query->have_posts()) :
    
                $post_query->the_post();
    
                global $post;
    
                $data[] = get_field('opponent', $post->ID);
    
            endwhile;
    
            wp_reset_postdata();
        endif;
    
        print_r($data);
    
        return new WP_REST_Response($data);
    }
    
    
  • Thanks for the rapid reply. It is working in Elementor, the suggestion from ACF support of using the Link (rather than URL) field type is not working in Elementor.

    My only missing ‘functionality’ is to display text as the link rather than the link itself, such as using:

    Visit W3Schools.com!

    rather than:

  • Thanks for the rapid reply, it’s very much appreciated. It is working in Elementor, the suggestion from ACF support of using the Link (rather than URL) field type is not working in Elementor.

    My only missing ‘functionality’ is to display text as the link rather than the link itself, such as using:

    <a href="https://www.w3schools.com">Visit W3Schools.com!</a>

    rather than:

    <a href="https://www.w3schools.com"></a>

  • Thanks for the rapid reply. It is working in Elementor, the suggestion from ACF support of using the Link (rather than URL) field type is not working in Elementor.

    My only missing ‘functionality’ is to display text as the link rather than the link itself, such as using:

    <a href="https://www.w3schools.com">Visit W3Schools.com!</a>

    rather than:

    <a href="https://www.w3schools.com"></a>

  • https://stackoverflow.com/questions/58914010/insert-repeater-rows-in-flexible-content-programmatically
    Using the information above I was able to get a repeater to work inside a Flexible Content block when it is a single level. As you can tell from my example, I have Flexible Content inside Flexible Content. How would I alter it to make it work another level down?

    $fc_data = array(
            'flexible_content_field_key'          => 'field_5a81b3845b0a3',
            'flexible_content_layout'             => 'directory_table',
            'flexible_content_repeater_field_key' => 'field_5a846b336d34f',
        );
  • I have Field Group “nimipäivät” (namedays)

    Inside that I have 2 fields

    “nimi” (name) = text
    “päivämäärä” (date) = date picker
    IMAGE:https://ibb.co/Gx8Z7YS

    Also I have Custom post plugin and there is added namedays
    IMAGE: https://ibb.co/6X79X4F

    Group fields post rule is set to nimipäivät IMAGE:https://ibb.co/Gx8Z7YS

    Now I would need to show todays date posts ONLY on my homepage.

    I have this code added to my funtions.php

    function show_todays_name_days() {
    // Hae tämän päivän päivämäärä
    $today = date(‘Ymd’); // Muutettu takaisin Ymd-muotoon

    // Luo uusi WP_Query-objekti
    $args = array(
    ‘post_type’ => ‘nimipaivat’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘field_65236d64b874e’, // Päivitä tämä kentän avaimellasi
    ‘value’ => $today,
    ‘compare’ => ‘=’
    )
    )
    );

    $query = new WP_Query($args);

    // Tarkista, onko postauksia
    if ($query->have_posts()) {
    while ($query->have_posts()) {
    $query->the_post();
    // Tulosta postauksen otsikko ja sisältö
    echo ‘<h2>’ . get_the_title() . ‘</h2>’;
    echo ‘<div>’ . get_the_content() . ‘</div>’;
    }
    } else {
    // Ei postauksia tälle päivälle
    echo ‘Ei nimipäiviä tänään.’;
    }

    // Palauta alkuperäinen postausdata
    wp_reset_postdata();
    }

    add_shortcode(‘show_todays_name_days’, ‘show_todays_name_days’);

    And I am using this shortcode : [show_todays_name_days]

    But this code doesnt work and I dont know how to show todays date posts on my homepage.

    Using also Elementor with Hello theme

  • I have Field Group “nimipäivät” (namedays)

    Inside that I have 2 fields

    “nimi” (name) = text
    “päivämäärä” (date) = date picker
    IMAGE:https://ibb.co/Gx8Z7YS

    Also I have Custom post plugin and there is added namedays
    IMAGE: https://ibb.co/6X79X4F

    Group fields post rule is set to nimipäivät IMAGE:https://ibb.co/Gx8Z7YS

    Now I would need to show todays date posts ONLY on my homepage.

    I have this code added to my funtions.php

    function show_todays_name_days() {
    // Hae tämän päivän päivämäärä
    $today = date(‘Ymd’); // Muutettu takaisin Ymd-muotoon

    // Luo uusi WP_Query-objekti
    $args = array(
    ‘post_type’ => ‘nimipaivat’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘field_65236d64b874e’, // Päivitä tämä kentän avaimellasi
    ‘value’ => $today,
    ‘compare’ => ‘=’
    )
    )
    );

    $query = new WP_Query($args);

    // Tarkista, onko postauksia
    if ($query->have_posts()) {
    while ($query->have_posts()) {
    $query->the_post();
    // Tulosta postauksen otsikko ja sisältö
    echo ‘<h2>’ . get_the_title() . ‘</h2>’;
    echo ‘<div>’ . get_the_content() . ‘</div>’;
    }
    } else {
    // Ei postauksia tälle päivälle
    echo ‘Ei nimipäiviä tänään.’;
    }

    // Palauta alkuperäinen postausdata
    wp_reset_postdata();
    }

    add_shortcode(‘show_todays_name_days’, ‘show_todays_name_days’);

    And I am using this shortcode : [show_todays_name_days]

    But this code doesnt work and I dont know how to show todays date posts on my homepage.

    Using also Elementor, Hello theme

  • For some strange reason, my response doesn’t seem to be submitting! This is my third try – so apologies if you’ve received one or two responses previous to this one.

    I followed the short YT tutorial at https://youtu.be/0As393DZyZs for instructions on how to do this.

    Not knowing how to directly answer your question I’ve recorded a short video tour of my configuration:

    https://youtu.be/0As393DZyZs

    Thanks for your continued help – and for staying awake!

  • I created the options page mainly by following the directions in this short YT video: https://youtu.be/0As393DZyZs

    I’m not exactly sure what you’re asking for, so have responded by recording a quick “video tour” of my configuration, hoping you’ll see the answer you’re looking for somewhere in it!

    https://notes.websmithian.com/l/0uoEPX

    Thanks for the help (and for staying awake!).

  • So @drew321, I try again maha…

    For your question about post_id, you have multiple ways. Just, all depend of your structure. How you have set that? …

    Since I don’t know the answer, I’ll tell you again how I would do it hehe.

    With WordPress you can create admin pages, but with ACF Pro, you can do it in a simpler way.

    Put a look here: https://www.advancedcustomfields.com/resources/options-page/.

    If you manage your admin pages with ACF Options Pages, you’ll be able to user update_field with “option” value for your $post_id instead of a specific post ID.

    For your question about Fetch: Fetch has coming with modern browser. But Fetch is like Ajax and it’s JavaScript. Not related with WordPress. Put a look here: https://www.w3schools.com/js/js_ajax_intro.asp

    But with WordPress, you can manage Ajax/fetch with security. You need to use the hook wp_ajax_{action} or wp_ajax_nopriv_{action} for that. Put a look here: https://developer.wordpress.org/reference/hooks/wp_ajax_action/

  • @drew321 Probably, you want use “option” for the $post_id but I can’t be specific without more details. Maybe I’m wrong.

    For your question about fetch: fetch is like Ajax and it’s appear with modern browsers. Its JavaScript, not WordPress or PHP. You can put a look on this page for quick details: https://www.w3schools.com/js/js_ajax_intro.asp (scroll to bottom of the page for fetch info instead of Ajax)

    But with WordPress, you can manage Ajax/Fetch with security. With the wp_ajax_{action} hook. Put a look here: https://developer.wordpress.org/reference/hooks/wp_ajax_action/

  • This reply has been marked as private.
  • Hi John,

    Thank you so much for your kind reply, but unfortunately it doesn’t work.

    Here’s my final code block:

    $tour_start_date = get_field(‘tour_start_date’, $item->get_product_id());
    if ($tour_start_date) {
    echo ‘<p>’ . esc_html($tour_start_date) . ‘</p>’;
    }

    https://drive.google.com/file/d/1YNShRXEoQQ4ACnRHBE8rYcXhOf0kdcHx/view?usp=sharing

    https://drive.google.com/file/d/1YJMmjoqz6p0vIorrQFbWTEq3Uzjnz2Br/view?usp=sharing

    Did I miss something?

  • Hi John,

    Thank you so much for your kind reply, but unfortunately it doesn’t work.

    Here’s my final code block:

    $tour_start_date = get_field(‘tour_start_date’, $item->get_product_id());
    if ($tour_start_date) {
    echo ‘<p>’ . esc_html($tour_start_date) . ‘</p>’;
    }

    https://drive.google.com/file/d/1YNShRXEoQQ4ACnRHBE8rYcXhOf0kdcHx/view?usp=sharing

    https://drive.google.com/file/d/1YJMmjoqz6p0vIorrQFbWTEq3Uzjnz2Br/view?usp=sharing

    https://drive.google.com/file/d/1YKIUFwV7x-bhcf041aL5vZZ6HnPcqWQX/view?usp=sharing

    https://drive.google.com/file/d/1YJrxKaEKjtQ0pJOxnG_0n33H6TgVKczg/view?usp=sharing

    Did I miss something?

  • So here is what the current logic produces:

    array(3) {
        [
            0
        ]=> array(1) {
            [
                "field_64dfd8bf4bc3e"
            ]=> array(4) {
                [
                    "field_64dfd8bf4bc3f"
                ]=> string(8) "kencraft" [
                    "field_64dfd8bf4bc40"
                ]=> string(8) "Kencraft" [
                    "field_64dfd8bf4bc41"
                ]=> string(69) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/07/kencraft.jpg" [
                    "field_64dfd8bf4bc42"
                ]=> array(2) {
                    [
                        0
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(13) "21cc_walkdown" [
                            "field_64dfd8bf4bc44"
                        ]=> string(13) "21CC WALKDOWN" [
                            "field_64dfd8bf4bc45"
                        ]=> string(74) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/07/21cc_walkdown.jpg"
                    } [
                        1
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(13) "25cc_walkdown" [
                            "field_64dfd8bf4bc44"
                        ]=> string(13) "25CC WALKDOWN" [
                            "field_64dfd8bf4bc45"
                        ]=> string(74) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/07/25cc_walkdown.jpg"
                    }
                }
            }
        } [
            1
        ]=> array(1) {
            [
                "field_64dfd8bf4bc3e"
            ]=> array(4) {
                [
                    "field_64dfd8bf4bc3f"
                ]=> string(19) "bayrider_flatbottom" [
                    "field_64dfd8bf4bc40"
                ]=> string(20) "Bay Rider Flatbottom" [
                    "field_64dfd8bf4bc41"
                ]=> string(80) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/07/bayrider_flatbottom.jpg" [
                    "field_64dfd8bf4bc42"
                ]=> array(5) {
                    [
                        0
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(14) "bay_rider_2460" [
                            "field_64dfd8bf4bc44"
                        ]=> string(14) "BAY RIDER 2460" [
                            "field_64dfd8bf4bc45"
                        ]=> string(75) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/08/bay_rider_2460.jpg"
                    } [
                        1
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(16) "bay_rider_2260fs" [
                            "field_64dfd8bf4bc44"
                        ]=> string(16) "BAY RIDER 2260fs" [
                            "field_64dfd8bf4bc45"
                        ]=> bool(false)
                    } [
                        2
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(14) "bay_rider_2260" [
                            "field_64dfd8bf4bc44"
                        ]=> string(14) "BAY RIDER 2260" [
                            "field_64dfd8bf4bc45"
                        ]=> bool(false)
                    } [
                        3
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(14) "bay_rider_2260" [
                            "field_64dfd8bf4bc44"
                        ]=> string(14) "BAY RIDER 2260" [
                            "field_64dfd8bf4bc45"
                        ]=> bool(false)
                    } [
                        4
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(14) "bay_rider_2060" [
                            "field_64dfd8bf4bc44"
                        ]=> string(14) "BAY RIDER 2060" [
                            "field_64dfd8bf4bc45"
                        ]=> bool(false)
                    }
                }
            }
        } [
            2
        ]=> array(1) {
            [
                "field_64dfd8bf4bc3e"
            ]=> array(4) {
                [
                    "field_64dfd8bf4bc3f"
                ]=> string(12) "bayrider_bay" [
                    "field_64dfd8bf4bc40"
                ]=> string(13) "Bay Rider Bay" [
                    "field_64dfd8bf4bc41"
                ]=> string(73) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/07/bayrider_bay.jpg" [
                    "field_64dfd8bf4bc42"
                ]=> array(2) {
                    [
                        0
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(17) "bay_rider_219_bay" [
                            "field_64dfd8bf4bc44"
                        ]=> string(17) "BAY RIDER 219 BAY" [
                            "field_64dfd8bf4bc45"
                        ]=> string(78) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/08/bay_rider_219_bay.jpg"
                    } [
                        1
                    ]=> array(3) {
                        [
                            "field_64dfd8bf4bc43"
                        ]=> string(17) "bay_rider_239_bay" [
                            "field_64dfd8bf4bc44"
                        ]=> string(17) "BAY RIDER 239 BAY" [
                            "field_64dfd8bf4bc45"
                        ]=> string(78) "http://kencraftboats.wpdev.me/wp-content/uploads/2023/08/bay_rider_239_bay.jpg"
                    }
                }
            }
        }
    }
  • Also in my-block.php file, is there a way to get
    <script type="module" src="https://unpkg.com/@splinetool/viewer/build/spline-viewer.js"></script> to process in the editor?

    This doesn’t seem to process in the editor; only on the front end:

    <div <?php echo $anchor; ?>class="<?php echo esc_attr( $class_name ); ?>">
    <script type="module" src="https://unpkg.com/@splinetool/viewer/build/spline-viewer.js"></script>
    <spline-viewer url="<?php echo $text; ?>"></spline-viewer>
    </div>
    
Viewing 25 results - 2,926 through 2,950 (of 21,345 total)