Notification When Post Approved

You can use publish_post action hook for notifying post author. function wpcs_author_notification( $post_id ) { $post = get_post( $post_id ); $author = get_userdata( $post->post_author ); $message = “Hi ” . $author->display_name . “, Your post, ” . $post->post_title . ” has just been published at ” . get_permalink( $post_id ); wp_mail( $author->user_email, “Your article is … Read more

Custom post page has attributes of latest post [closed]

I believe you are talking about the blog page, the page you set as posts page when you select a static front page. Many functionality like breadcrumbs relies on the $post global. By default, if nothing breaks the $post global, before the loop, the $post global should always hold the first post in the main … Read more

Single post pagination

It’s possible to modify the content pagination with the content_pagination filter. Here’s a way to always display the content of the first page: /** * Content Pagination: Always display the content of the first page */ add_filter( ‘content_pagination’, function( $pages ) { // Nothing to do if there’s no pagination if( count( $pages ) <= … Read more

link to page_for_posts

I wouldn’t classify this as a WordPress issue persay. The problem is that any get_*() functions return values. This means that get_permalink() returns the permalink to be assigned ot a variable which you’re not doing or intend to do in this case. So we have the value sitting in memory all we need to do … Read more

Auto selection of category based on subject line or TAG

I doubt there are any plugins out there that can do what you want “out-of-the-box”, however you could probably write a plugin to do what you’re looking for. Some basic boilerplate logic could look like function jcharnock_insert_post_category( $post_id, $post, $update ) { // Only run on inserts. if ( $update ) { return; } $title_categories … Read more

How to filter homepage posts by popularity? [closed]

First thing we need to do is create a function that will detect post views count and store it as a custom field for each post. To do this, paste the following codes in your theme’s functions.php file function wpb_set_post_views($postID) { $count_key = ‘wpb_post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); … Read more