complex get_posts() query to select child pages

You need a loop for this to handle the condition: /** list for course and childless department pages */ $course_and_childless_department_pages = array(); /** get department pages */ $department_pages = get_children( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ) ); foreach ( $department_pages as $department_page ) { /** get course pages (for department … Read more

Not able to get random post

// Get a single random post from fetched posts $post = $news[rand(0, 4)]; setup_postdata($post); echo the_title(); echo the_intro(); // <- Custom function to retrieve custom field

How to create a “latest news” page showing a list of posts from blog category

Probably the get_posts tag. It’s simple, you just need a loop. <?php $args = array( ‘numberposts’ => 5, ‘cat’ => 5 ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <?php the_date(); ?> <br /> <?php the_title(); ?> <?php the_excerpt(); ?> </div> <?php endforeach; ?> That will show the last … Read more

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