Hide page header on both index and author pages [closed]
Just a simple logic error. You want to display the header if you’re not on the front page AND if you’re not on an author page. if(!is_front_page() && !is_author() ) {
Just a simple logic error. You want to display the header if you’re not on the front page AND if you’re not on an author page. if(!is_front_page() && !is_author() ) {
admin-ajax.php nulls all php variables
Diffrent search templates for different post types
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
Multiple Plugins Interacting with Menu
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
You could use: <?php $categories_list = get_the_category_list( __( ‘, ‘, ‘twentyeleven’ ) ); if(has_category()) { echo $categories_list; } ?> Here’s the has_category function via the Codex.
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
is_admin() triggers error
I do not know much about how $[‘globals’] decides what browser you are using, i assume it uses some kind of browser sniffing which is generally a bad technique as the results it produces can be less than reliable. Why do you need to use PHP anyway, just putting this as HTML in the head … Read more