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

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

Why are array_slice() and array_chunk() not working?

You need to do the slice on the results, not the arguments to the function. So: $arr = array( //$section_top_parent is the top parent of the custom post type “section” ‘child_of’ => $section_top_parent, ‘post_type’ => ‘section’, ‘title_li’ => NULL, ‘depth’ => 1, ‘sort_order’ => ‘asc’, ); $result = wp_list_pages($arr); $sliced = array_slice($result, 3, 5); wp_list_pages($sliced);

Taxonomy terms not properly displaying as array

I found out that I forgot to implode the array values on public function job_dashboard( $atts ) function. Updated code below: private function get_job_dashboard_query_args( $posts_per_page = -1, $post_status = null, $category = null ) { $post_status_array = [ ‘publish’, ‘expired’, ‘pending’, ‘draft’, ‘preview’ ]; if (!$post_status) { // if not set $post_status = $post_status_array; } … Read more

How to randomise my menu items?

Ehm, afaik the return value of the menu fn is an object: You need to type cast earlier $menu_items = (array) wp_get_nav_menu_items( 26 ); // Typecast here $menu_items = array_rand( $menu_items, 3 ); foreach ( $menu_items as $key => $menu_item ) { echo $menu_item[‘title’]; }

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