How can I get the content of the current page in my loop while merging post-type

Ok solved it like this : <?php $mainquery = get_queried_object(); $args = array( ‘pagename’ => ‘Accueil’ //as my home page ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div class=”entry-content”> <?php the_content(); // here I can load my content ?> </div><br><br> <?php } } wp_reset_postdata(); global $wp_query; $args = array_merge($wp_query->query, … Read more

How to display MySQL table data which is stored as an array?

I would like to replace those arrays with real values. Is it possible? I am assuming you want to access and print those two variables which is shown as “Array” in the print out (contact, question_answers_array) Solution as follows – replace your foreach look with below (I didn’t test code but should give you an … Read more

Display one random image from Media Library

I can’t comment due to lack of reputation, so I’ll address the issue rudtek mentioned. Personally, I never came across a host that disables PHP’s rand() function, but in case there is such a lousy host, you can opt for a more efficient way of doing things. What you can do is to get all … Read more

Retrieve array items without page ID

to get pages as array use get_pages() instead. now once we have a list we can check the size of list and split it. Let’s have an example: $allpages = get_pages( array( ‘child_of’ => $section_top_parent, ‘post_type’ => ‘section’, ‘depth’ => 1, ‘sort_order’ => ‘asc’ ) ); //check $allpages has any value if($allpages){ //calculate the array … Read more