Hot answers tagged

1

You need the WP_Query documentation. WP_Query is very powerful, and you can do a lot with it :) In your case, I don't think exclude is a valid parameter. What you're probably looking for is this: $query->set( 'post__not_in', array( 34 ) ); Here's the Post & Page Parameters section of the documentation, which covers this and the other parameters ...


1

Duplicates don't just come from Pages and Posts, WordPress also defines Images and Files from the Media Library as "Posts". This means if you have a file / image in the Media Library with the same name as a page, it will assign the next duplicate a -2 ( from the wp_unique_post_slug() function ) so there's no URL conflicts. TL;DR - Duplicate? Search for ...


1

Use wp_list_pluck to extract an array of IDs from your query, then pass those to is_page. $top_level_ids = wp_list_pluck( $top_level_pages, 'ID' ); if ( is_page( $top_level_ids ) ) { // do something }


1

If you want to change the single page page-{page-slug} is a good choice if you want the page template for specific page only and not multiple pages. Check out his custom page template for specific page If you are talking about custom post type We can use single-$posttype.php , here $posttype is your custom post type slug. WordPress template Hierarchy ...


1

Since 3.7 there is a filter to change the width of the wrapping div directly. This will fix the extra 10px, and won't let the caption extend past the width of the image (unlike width: auto !important). function wp456_img_caption_width( $width, $atts, $content){ //by default 10 is added if image caption return $width - 10; } add_filter( '...



Only top voted, non community-wiki answers of a minimum length are eligible