Good practical way to do loop within loop to show child custom type using a template code

<?php global $post; foreach ($event_photos_obj as $post) : … … // set up product in order to use native wordpress api setup_postdata($post); /* Include the single view for the product (photo). */ include ….. endforeach; wp_reset_postdata();?> my mistake my code is that setup_postdata with $product instead of $post as the tutorial said : https://codex.wordpress.org/Function_Reference/setup_postdata This … Read more

Retrieve a post with its ACF repeater fields in wordpress

<?php $the_query = new WP_Query(array( ‘post_type’ => ‘our-partners’, ‘posts_per_page’ => 1, ‘order’ => ‘DESC’ )); if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); if( have_rows(‘slider_partenaires_hp’) ): //”slider_partenaires_hp” is the repeater field // loop through the rows of data while ( have_rows(‘slider_partenaires_hp’) ) : the_row(); // display a sub field value echo “<li … Read more

How to change data format in custom meta box field [closed]

EDIT You should be using date_create_from_format or its alias DateTime::createFromFormat() to convert on format to another. You can try the following $date = DateTime::createFromFormat(‘m-d-Y’, ’03-09-2015′); echo $date->format(‘d-m-Y’); This will convert 03-09-2015 to 09-03-2015 ORIGINAL ANSWER This is more a PHP question than WordPress question. You can simply use str_replace to change the / in your … Read more

Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]

Please go through the code below. I have tried and tested 🙂 /** * Adds a box to the side column on the Order edit screens. * It checks if the order status is completed & then adds meta box. */ function add_drivers_meta_box() { global $current_screen; /* In the second condistion below, please change it … Read more

ACF: Not displaying ACF data from another post

There was a flexible content container with the content inside that required an extra loop to reach the content. This helped (https://support.advancedcustomfields.com/forums/topic/get-another-pages-flexible-content/) <ul class=”rslides_m16 rslides”> <?php if( have_rows(‘page_modules’, $postID) ): while ( have_rows(‘page_modules’, $postID) ) : the_row(); if(get_row_layout() == “2-carousel-featured”): if( have_rows(‘items’) ): while ( have_rows(‘items’) ) : the_row();?> <li> <img src=”https://wordpress.stackexchange.com/questions/231217/<?php echo get_sub_field(“image’);?>”> </li> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)