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

Show different badge based upon the user role

You can use get_queried_object to get data in the current author page: <?php $author = get_queried_object(); // uncomment next line to see all author data // print_r( $author ); if( in_array( ‘author’, $author->roles ) ) : echo “author”; elseif( in_array( ‘subscriber’, $author->roles ) ) : echo “subscriber”; endif;

Wrong Sub-Page Order

Try this: $args = array( ‘sort_order’ => ‘asc’, ‘sort_column’ => ‘menu_order’, ‘hierarchical’ => 1, ‘parent’ => $post->ID ); $pages = get_pages($args);

How to build a post and comment editing form in a page?

To edit is a bit harder then just creating, but not that hard first you only display the edit link to the author so you add something like this to your loop: global $current_user; get_currentuserinfo(); while (have_posts()) : the_post(); //regular loop stuff //and check if the post author is the current user if ($post->post_author = … Read more

WordPress post/page pagination (page links) to go back to the first section

If we want to add a First page link between Previous page and Next page links: Pages: Previous page First page Next page then we could use the wp_link_pages_args, wp_link_pages and wp_link_pages_link filters. Here’s one such example: Example First we check the next_or_number attribute to see if the next mode is active: add_filter( ‘wp_link_pages_args’, ‘wpse_initialize’ … Read more

Is there a way to stop WP editor deleting

I would suggest a shortcode: function gcse_wpse_143459($atts,$content) { return ‘<gcse:searchbox-only></gcse:searchbox-only>’; } add_shortcode(‘gcse’,’gcse_wpse_143459′); Then use [gcse] instead of trying to paste in an oddball html-ish tag.

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