Skip Navigation

[Résolu] global function for empty fields

This support ticket is created Il y a 5 années et 11 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Marqué : 

Ce sujet contient 3 réponses, a 2 voix.

Dernière mise à jour par Akhil Il y a 5 années et 10 mois.

Assisté par: Waqar.

Auteur
Publications
#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!