Tag Info

New answers tagged

2

With everything moving towards OOP programming with classes and the use of objects increasing and favored above the use of arrays as such, I would definitely go with returning results as an object. This just makes everything easier for future use But at the end of the day, you should always use what you are comfortable with within a set scope while keeping ...


0

You can save post meta with the same meta key, just set the $unique parameter to false. if(isset($_POST['save'])){ foreach ($_POST as $post_key => $post_value){ if ( 'save' === $post_key ) continue; if ( is_array($post_value) ) { foreach ( $post_value as $key => value ) { ...


0

I played with the code for a bit longer and managed to get it working. Answer below add_filter( 'gform_pre_render', 'freetrial_studios' ); add_filter( 'gform_pre_validation', 'freetrial_studios' ); add_filter( 'gform_pre_submission_filter', 'freetrial_studios' ); add_filter( 'gform_admin_pre_render', 'freetrial_studios' ); function freetrial_studios( $form ...


0

I would advise using the built-in functions ACF functions for this. Elliot has provided a full toolbox for you and documentation for all field types: <?php // Conditional statement (Single Value) if(get_field('page_layout') == "col_1") { //... } //Conditional statement (Multiple Values) if( in_array( 'col_1', get_field('page_layout') ) ) { ...


0

Here is my own solution. In my html I've assign id to all the item and inside the form I've added an input option where I pass the value through the script and it was saved later. Simple... script jQuery(document).ready(function($){ $(".sortable").sortable({ connectWith: '.sortable', receive: function (event, ui) { ...


0

get_the_ID gives you the ID of the current post, but at no point during that loop do you change what the current post is. It's always the last post processed in the previous loop because that's the last time you called the_post(). This is why you always get the same ID. Instead, store the ID: $results[$key]['ID'] = $value->ID; Then echo that instead: ...



Top 50 recent answers are included