get_children displaying images removed from the page
get_children displaying images removed from the page
get_children displaying images removed from the page
display childs without parent
$args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID, ); $children= new WP_Query( $args ); $seasonepisode = array( ‘post_title’ => $episodetitle, ‘post_content’ => ‘Some Content’, ‘post_status’ => ‘publish’, ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘page_template’ => ‘template-songlist.php’ ); if ( $children->have_posts() ){ while ( $children->have_posts() ) { $children->the_post(); if(get_the_title() != $episodetitle){ wp_insert_post($seasonepisode); … Read more
It turns out I have an errant pre_get_posts function: function fgw_parents_only( $query ) { if ( ! is_admin() && $query->is_post_type_archive( ‘project’ ) ) { $query->set( ‘post_parent’, 0 ); $query->set( ‘posts_per_page’, -1); } } add_action( ‘pre_get_posts’, ‘fgw_parents_only’ ); Not exactly sure why is_post_type_archive caused this to show up on a single-project.php template, but I managed to … Read more
a) If you have reordered the images under the uploaded to this post in the media browser then they should have menu_order>0 and you can get that order with ‘orderby’ => ‘menu_order’, ‘order’ => ‘asc’ b) If you haven’t, then menu_order=0 for all these images and you will need to use ‘orderby’ => ‘ID’, ‘order’ … Read more
<?php $current_page_id = get_the_ID(); wp_list_pages(“child_of={$current_page_id}&sort_column=menu_order&title_li=”); ?> Please check the above code
First of all you should alway separate php from javascript. Generally talking, it’s a bad practise mix them, and specifically to WordPress, it also force you to add javascript inline instead using the WordPress proper way: using wp_enqueue_script. When you need pass variables from PHP to javascript, the proper WordPress way to do it is … Read more
The get_children function retrieves posts (an upoaded image is also a post) that are dependent on the post with a certain ID. An image becomes a child of a post when it is uploaded while editing that post. It does not become a child of a post when it is reused. So if you are … Read more
What about: $taxName = “tvr_amenity”; $terms = get_terms($taxName,array(‘parent’ => 0)); foreach($terms as $term) { echo ‘<a href=”‘.get_term_link($term->slug,$taxName).'”>’.$term->name.'</a>’; $term_children = get_term_children($term->term_id,$taxName); echo ‘<ul>’; foreach($term_children as $term_child_id) { $term_child = get_term_by(‘id’,$term_child_id,$taxName); echo ‘<li><a href=”‘ . get_term_link( $term_child->name, $taxName ) . ‘”>’ . $term_child->name . ‘</a></li>’; } echo ‘</ul>’; }
I doubt you could paginate within a post display. It would be more effective to display all the image attachments at the page load, and have a script do the pagination. You can find a lot of them on such sites: http://www.themeflash.com/30-powerful-jquery-slideshow-sliders-plugins-and-tutorials/ You need to be able to edit your template files, specifically the header … Read more