- tests on editing author page with acf fields

- some reflexions on registrations
This commit is contained in:
asus
2024-02-29 23:45:02 +01:00
parent 6e88bba879
commit bd30c97194
7 changed files with 114 additions and 241 deletions

View File

@@ -0,0 +1,69 @@
<?php
/*
* the wp_footer hook fire on the front end just before the closing body tag
* this function depends on the names of acf fields :
* - afficher_offre_*
* - -> Masquer / *
* - offre_x* (image, titre, txt)
function my_custom_js_function_PLGNTLS() {
if (!is_singular("project"))
return ;
error_log("------");
// list all acf fields of the current post
$acf_group_fields = get_fields();
// list offers to mask
$offers_to_mask = array_filter($acf_group_fields, function($value, $key){
if (!str_starts_with($key, "afficher_offre_"))
return false;
if ($value === "Masquer")
return true;
}, ARRAY_FILTER_USE_BOTH);
foreach($offers_to_mask as $key => $value){
$needle = str_replace( "afficher_", "",$key);
}
error_log("needle");
error_log($needle);
$to_mask = array_filter($acf_group_fields, function($value, $key){
if (str_starts_with($key, $needle))
return true;
}, ARRAY_FILTER_USE_BOTH);
// select only the acf fields "afficher_offre_*"
// $acf_offers = array_filter($acf_group_fields, function($field){
// $field_name = $field['name'];
// return str_starts_with($field_name, "afficher_offre_");
// });
// list of "afficher_offre_" for current post that are on "Masquer"
// error_log("---");
// $to_mask = array();
// foreach($acf_offers as $offer){
// $key = $offer['key'];
// error_log("key:");
// error_log($key);
// $field_value = get_field($key);
// error_log("field_value:");
// error_log($field_value);
// if ($field_value === 'Masquer') {
// $to_mask[] = $offer;
// }
// }
$output = $to_mask;
$fipfcard_project = new PLGNTLS_class();
return $fipfcard_project->add_to_front(
array(
"css/partenaires/partenaires.css",
"js/partenaires/switch_offers.js",
),
compact(
"output",
)
);
}
add_action('wp_footer', 'my_custom_js_function_PLGNTLS');
*/
?>

View File

@@ -38,6 +38,10 @@ add_action('template_redirect', 'check_paypal_request');
/**
* call to paypal_shortcode_content()
*/
function fipf_paypal_shortcode_content()
{
$fipfcard_paypal = new PLGNTLS_class();
@@ -67,6 +71,9 @@ function fipf_paypal_shortcode_content()
return $added_to_front;
}
add_shortcode('fipf_paypal_shortcode', 'fipf_paypal_shortcode_content');
/**
@@ -100,5 +107,4 @@ function fipf_routes_endpoints()
add_action('rest_api_init', 'fipf_routes_endpoints');
?>