How To Display Date (/Time/Author) In pages?

WordPress has some nifty functions which do this for you. You’ll need some experiences with HTML, CSS, PHP to style the output and understand what these functions do but the functions you’re looking for are: the_date() which displays the post date. the_author() which displays the author of the post. In your theme will most likely … Read more

Include related posts on a page

You could easily modify the page template of your theme to include a section that reads “Related Posts” at the bottom and then execute a simple PHP query to get posts as follows: <?php query_posts(‘category_name=wordpress&showposts=5’); ?> <?php while (have_posts()) : the_post(); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/10085/<?php the_permalink(); ?>”> <?php the_title(); ?> </a> </li> <?php endwhile; ?> … Read more

Add a custom option to a page in backend

To add a option box for a page or post, you need to use add_meta_boxes action. //Register Meta Box function register_meta_box() { add_meta_box( ‘meta-box-id’, __( ‘MetaBox Title’, ‘text-domain’ ), ‘meta_box_callback’, ‘post’, ‘advanced’, ‘high’ ); } add_action( ‘add_meta_boxes’, ‘register_meta_box’); //Add field function meta_box_callback( $post_id ) { $output=”<label for=”title_field”>”. esc_html__(‘Title Field’, ‘text-domain’) .'</label>’; $title_field = get_post_meta( $post_id->ID, … Read more

Listing all sub-pages?

easy just pass it the $id off which to get the children global $id; wp_list_pages(“title_li=&child_of=$id”); of if you want in the loop then wp_list_pages(“title_li=&child_of=$post->ID”);

How to disable Page Attributes dropdown in wp-admin

Removing support for page attributes will prevent that box from appearing… function remove_page_attribute_support() { remove_post_type_support(‘page’,’page-attributes’); } add_action( ‘init’, ‘remove_page_attribute_support’ ); … but I don’t know if you need attributes support or not. If you don’t that is the fix. If you do, you will need to remove the box as per @KrzysiekDrozdz’s answer, but to … Read more

How do I turn comments off for pages, but not posts?

The Front-End Solution: Trick your templates You could fake that comments are open for specific post types. The following code works for all templates, that wrap the comment form (or whatever comment related code/UI elements) inside a conditional comments_open() check. The little magic … wrapped up in a quick’n’small plugin. /** * Plugin Name: Disable … Read more