Print Current Post Index number within Loop

I’m working on WordPress where I have following code to get posts within loop. <?php $posts = $woo_options[‘woo_latest_entries’]; query_posts(‘post_type=post&category_name=company’); if ( have_posts() ) : while ( have_posts() ) : the_post(); $count++; ?> /// Post Content Goes Here // <?php endwhile; endif; ?> Which Output posts inside Loops something like this… Post Goes Here …. Other … Read more

Split Content and Gallery

Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode itself: if(has_shortcode(get_the_content(), ‘gallery’)){ $pattern = get_shortcode_regex(); preg_match(“/$pattern/s”, get_the_content(), $matches); echo do_shortcode($matches[0]); } But this … Read more

Display featured products through custom loop in woocommerce on template page

I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do this was through a custom loop,( I do not wish to use shortcodes because I would like to add additional classes for styling etc. ) I also found … Read more

Getting only direct child pages in WordPress with get_pages

I am trying to fetch all direct children of a page. But I am getting all children and grand children as well. Any ideas? PHP Source: $args = array( ‘child_of’ => $post->ID, ‘parent ‘ => $post->ID, ‘hierarchical’ => 0, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘asc’ ); $mypages = get_pages( $args ); foreach( $mypages as $post … Read more