Single post template not working in wordpress

When we’re editing a post, the post editor is used to define the post’s content (and associated meta data). Meanwhile, the Block Templates within the Site Editor as you have accessed via Appearance > Editor > Templates define how the site and content is laid out and rendered. Admittedly none of the terminology terribly intuitive, … Read more

Plugin or code to send out email to admin when a post is created

No need for plugin here are a few lines of code you can modify and paste in your themes functions.php file and you will get a new email whenever a post is published: add_action(‘publish_post’, ‘send_admin_email’); function send_admin_email($post_id){ $to = ‘[email protected]’; $subject=”mail subject here”; $message = “your message here ex: new post published at: “.get_permalink($post_id); wp_mail($to, … Read more

Function to delete post from category older than 2 days

The get_posts() call is retrieving posts that were published after two days earlier. The after parameter retrieves posts after a certain date, and strtotime() is retrieving the date from two days ago. Try changing after to before, and then change strtotime() first parameter to reflect your request. Researching the get_posts() and strtotime() functions will be … Read more

Display posts from a specific category on frontpage.php template?

Take a look at multiple loops for examples And also look at the content.php file in the Twenty Fourteen theme <?php // The Query $category_query = new WP_Query( ‘category__in=11’ ); // The Loop if ( $category_query->have_posts() ) { echo ‘<ul>’; while ( $category_query->have_posts() ) { $category_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; … Read more

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