Skip Navigation

[Gelöst] global function for empty fields

This support ticket is created vor 5 Jahren, 11 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Akhil vor 5 Jahren, 11 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1174934

Hi waqar, good day. Happy new year!

I have this idea to create a global function to replace all the empty fields with an "update" button,
I am currently using shortcode "update-button" for this purpose, it works just that I need to edit "all" all my templates codes to add this,

is there anything can be done? this could be useful as the main toolset settings option too.

#1174935

something like this?

<?php 
  
    if (!empty($wpcf)) {
?>
        <div class="update">update </div>
<?php
    }
?>
#1175126

Hi Dee,

Thanks for asking and I wish you a wonderful new year ahead.

Due to a variation in field types, content items, and project requirements etc, bulk editing is something that is left for website admins to implement, on a case to case basis.

But we always welcome and encourage new feature requests and you can submit this directly to the product management team, through the form at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

To create a custom code or shortcode that can update/add custom field values in bulk, you can use "get_posts" function ( ref: https://codex.wordpress.org/Template_Tags/get_posts ) to cycle through your desired post types and then use "get_post_custom" function ( ref: https://codex.wordpress.org/Function_Reference/get_post_custom ) to cycle through all the custom field values attached to individual post.

To perform the update operation on an empty custom field value you can use "update_post_meta" function ( ref: https://codex.wordpress.org/Function_Reference/update_post_meta ).

I hope this helps!

regards,
Waqar

#1177428

My issue is resolved now. Thank you!