using is_paged for hiding image on posts

I read that it doesn’t work for posts using <!–nextpage–> Not necessarily, but basically, if the current URL ends with /page/<number> as in https://example.com/page/2/ and https://example.com/category/foo/page/2/, then is_paged() would work, i.e. it returns true on page 2, 3, etc. But for singular posts with a page break, i.e. the <!–nextpage–> tag, where the URL normally … Read more

Get all comments of author’s posts

It looks like there’s two problem with the code you’re trying to use. The first is AUTHOR_ID. Unless you have this defined somewhere else, then this is going to cause an undefined constant error. The second one is that there should be a closing PHP tag ?> before <?php endwhile; ?>. Another thing is, that … Read more

How to Get Posts, Including Private Ones?

Set the post_status argument to an array of desired post status strings, or to the string any to query regardless of status entirely: $posts = get_posts(array( ‘posts_per_page’ => -1, ‘post_type’ => ‘post’, ‘post_status’ => array( ‘publish’, ‘private’ ), ));

wp_insert_post_data: Limit number of Page but Post get affected

I would suggest one slight change to your logic as follows: function set_post_to_draft_page_only( $data, $postarr ) { if($data[‘post_type’] == ‘page’) { if( wp_count_posts(‘page’)->publish > 2 ) { $data[‘post_status’] = ‘draft’; } } return $data; } add_filter( ‘wp_insert_post_data’, ‘set_post_to_draft_page_only’, 99, 2 ); You were not returning $data if post type was anything other than ‘page’.

Add filter to the end of the post

2 options: 1) Edit your youtube_video() function so it return a string instead of printing the code 2) The easiest way… if you can edit your theme, place the youtube_video() call after showing your post content Edit: <?php function youtube_video() { $ret = “”; $ret .= “<div class=”post”>”; $newvar = urlencode(get_the_title()); include_once(ABSPATH . WPINC . … Read more

Posts vs Pages and categories

the way WordPress stores pages in the database is the same as it stores posts, so it makes no difference if the content is created as pages or posts (static or not). And if most of the content is static you can always use a caching plugin to serve that content as static.

Thumbnail Image to go in the post aswell

Use the post thumbnail for the single blog pages too. You can use the add_image_size() function to create an additional image size that is displayed on the blog posts. add_image_size(‘single-post-image’, 650, 250, true); // name, width, height, crop mode Then in single.php the_post_thumbnail(‘image-size’); Simply place the first function in your functions.php, and the second in … Read more