Need a conditional to test if title of parent page matches title of child page

solution here as function: function testchildren () { global $post; $childtest = get_pages(‘child_of=”.$post->ID); if( count( $childtest ) != 0 ) { return false; } else { return true; } } and implementation as markup: <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2> <?php if ( … Read more

Help with if else statement for separating content from image attachment

Technically, this should work: <!–display image–> <div class=”featured-image”> <?php $args = array( ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => null, ‘post_parent’ => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo wp_get_attachment_image( $attachment->ID, ‘full’ ); } } ?> </div> <?php $content = preg_replace(‘/<img[^>]+./’,”,get_the_content()); … Read more

Conditionals in WP_Query

You can simplify things by using the date_query of WP_Query(), instead of the posts_where filter. You can then try the following (untested): // Fetch from the ‘featured’ category $args = array( ‘posts_per_page’ => 1, ‘category_name’ => ‘featured’, ‘date_query’ => array( array( ‘after’ => ‘1 week ago’ ) ), ); $the_query = new WP_Query( $args ); … Read more

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