The field (ACF)
Naar navigatie springen
Naar zoeken springen
the_field
is een API-functie van ACF (Advanced Custom Fields):
[1]:
Displays the value of a specific field. Intuitive and powerful, this function can be used to output the value of any field from any location. Please note this function is the same as echo get_field().
Pagina-geassociëerd veld uitlezen
#!/bin/bash # ############################################################### # Go to example.com ############################################################### # cd /var/www/example.com ############################################################### # Use the_field (ACF command) ############################################################### # php_string='the_field("hero_text",7);' wp eval "$php_string"
Option-veld uitlezen
Om waardes uit te lezen die je in de interface vindt onder Options, moet je option
als tweede argument meegeven.
Voorbeeld:
<?php require_once("/var/www/kohlebuersten-webshop.de/wp-load.php"); # Without 'option' - None works ############################################### # # print_r(get_field_object("add_code_to_head")); # print_r(get_field_object("line")); # print_r(get_field_object("field_619b5b1f68a2f")); # print_r(get_field_object("cart_summary_title")); # print_r(get_field_object('shop_cart_continue_shopping')); # echo(get_field_object('shop_cart_continue_shopping')); # $field = get_field_object('shop_cart_continue_shopping'); # echo $field['label']; # echo $field['value']; # Read out a field - This works! ############################################### # print_r(get_field_object("field_619b5b0d68a2e")); # Read out a field using 'option' - All work! ############################################### # # the_field('shop_cart_continue_shopping', 'option'); the_field('shop_cart_direct_checkout', 'option'); ?>