Adding a time stamp on post view

You are nearly there, I’d say. I am sure there are many ways to do this. If it were me, I’d build a ‘nested’ array for this. Something like… array( ‘timestamp-1’ = array( ‘message’ => ‘Updated post1’, ‘message’ => ‘Updated post1’ ), ‘timestamp-2’ = array( ‘message’ => ‘Updated post3’, ‘message’ => ‘Updated post4’, ‘message’ => … Read more

Displaying posts on Homepage

Try the following using WP_Query: <div class=”news-column”> <h3>Latest News</h3> <ul> <?php //get news $args->posts_per_page = 5; //query $query = new WP_Query($args); while($query->have_posts()):$query->the_post(); ?> <li class=”news-item”> <h4><?php the_title(); ?></h4> <p><?php the_date(‘F jS, Y’); ?></p> <?php the_excerpt(); ?> <p class=”footnotes”><a href=”https://wordpress.stackexchange.com/questions/69725/<?php the_permalink(); ?>”>Continue reading</a></p> </li> <?php endwhile; wp_reset_postdata(); ?> </ul> </div> You can read more about other … Read more

Can’t match title in database

It’s most likely due to the title not being matched exactly. You might be having an extra space before/after/between the title either here or in the database

Add default content to post (for specific category)

default_content runs when a post is loaded into the editor, actually. You can check for categories when the post is saved, but you’d want the save_post hook, probably. You want to check the $_REQUEST global. add_filter( ‘default_content’, ‘my_editor_content’ ); function my_editor_content( $content ) { global $_REQUEST; if (isset($_REQUEST[‘post_category’]) && in_array($some_category_id,$_REQUEST[‘post_category’])) { $content = “My html … Read more

WordPress sub-posts and permalinks

Pages work this way, so you could either use pages or create a new post type (you’d need the hierarchical => true: function codex_custom_init() { $labels = array( ‘name’ => _x(‘Books’, ‘post type general name’, ‘your_text_domain’), ‘singular_name’ => _x(‘Book’, ‘post type singular name’, ‘your_text_domain’), ‘add_new’ => _x(‘Add New’, ‘book’, ‘your_text_domain’), ‘add_new_item’ => __(‘Add New Book’, … Read more

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