add comments custom fields after user is logged in
I believe you want is_user_logged_in if(is_singular(‘debate’) && is_user_logged_in()) { // … } (Note: is_singular is misspelled in your code.)
I believe you want is_user_logged_in if(is_singular(‘debate’) && is_user_logged_in()) { // … } (Note: is_singular is misspelled in your code.)
You can put the meta value of each post within an array while inside loop. Then just calculate the average of the ratings after the loop ends. for getting meta values you can see this link Function Reference/get post meta
This is mostly pure PHP, but you need to implode the array. add_shortcode(‘bundled_ids’,’bundled_ids_func’); function bundled_ids_func() { $meta_values = get_post_meta( get_the_ID() , ‘_bundled_ids’, true ); if (!empty($meta_values)) { $mydata = implode(‘,’,$meta_values); // add this line return $mydata; } }
In your code you are only creating one custom field with your add_post_meta() usage. Then when you use the get_post_meta() there is only one value in the post. Can you go into the actual post and look at the custom fields. Is there more than one custom field with the same “extras” key? If not, … Read more
Well, you use ACF for your custom field, right? In that case, replace the function “the_field” in your code with “get_field”. the_field echoes the field already, so the field is echoed before your tab shortcodes return from the function do_shortcode and get echoed, which results in “having the content of the field before the tab” … Read more
Finally i got the answer i was wrong because i tried to send the variable you can not send the variable you have to just put the name of custom field slug. In the bellow snippet i have replaced $field with my custom field name slug _some_field like:- $keys[‘How did you learn about us?’] = … Read more
Well to say that these custom fields are insecure in the wp core tables is to say that the usernames and passwords are also insecure, along with any private or password protected posts. As long as you are not outputting these custom fields anywhere but a secure page for logged in, paid up users, no … Read more
Just noticed the issue – since your ACF field is an options page, you need to pass the second argument options to get_field – add a bit of sanity checking too: $rows = get_field( ‘image_advert_repeater’, ‘options’ ); if ( ! empty( $rows ) && is_array( $rows ) ) { // Your code }
Fixed it, I think. Looks like I botched this line, and forgot to add in $variation. Now to figure out how to get this to display dynamically on the front end so it changes with each variation… function variable_fields( $loop, $variation_data, $variation ) {
Yes, it is possible to hide or show custom fields by user’s role. Use current_user_can() for finding current user role. This function returns true if current user has capability or role. For example your current user is “wholesale” then you can use like this: <?php if( current_user_can(‘wholesale’)) { ?> // stuff here for wholesale <?php … Read more