Remove Posts Quick Edit link for specific user role? WP 3.3

Based on this answer, yours was easy: add_filter(‘post_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); add_filter(‘page_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); // for Custom Post Types // add_filter(‘cpt_name_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); function wpse_49800_qe_download_link($actions, $post) { unset($actions[‘inline hide-if-no-js’],$actions[‘trash’]); return $actions; } Notice that you don’t mention the ‘Trash’, so it’s being removed as well. Plugin of interest Adminimize is able to hide … Read more

Insert custom div between posts

You can check your position within the loop using the current_post var of the $wp_query object, and insert markup at a specific spot or at some interval. A simple example: while( have_posts() ): the_post(); the_title(); the_excerpt(); // if current_post is 1, insert the div // note that current_post starts at 0, // so this will … Read more

Post content being duplicated by the_content();

The problem is still present, but I’ve found a workaround for now. When I replaced echo apply_filters(‘the_content’, get_post_field(‘post_content’, $post_id)) with echo wpautop( get_the_content() ), it worked. I also stopped using the variable $post since I wasn’t accessing the global post variable. So that makes my code look like so: $state_posts = array(); while ($query->have_posts()) { … Read more

One comment per user email per post

Try this, the code below will generate every comment by the $current_user->user_email for the author_email, if the $usercomment return something, then there is a comment by the current user so echo “thank you”, but if it’s not return anything output the form. global $current_user,$post; $usercomment = get_comments(array(‘author_email’ => $current_user->user_email, ‘post_id’ => $post->ID)); if($usercomment) { echo … Read more

Show number of posts AND number on current page

This should work, but I haven’t tested it: global $wp_query; $page = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $ppp = get_query_var(‘posts_per_page’); $end = $ppp * $page; $start = $end – $ppp + 1; $total = $wp_query->found_posts; echo “Showing posts $start through $end of $total total.”;

Set font size automatically according to number of words in post

Filter ‘the_content’, count the words, and add the markup you need. You should not use str_word_count() because it has issues with numbers and utf-8. So let’s start with a word count function: /** * Alternative for str_word_count(). * * @link http://toscho.de/2012/php-woerter-zaehlen/ * @param string $str * @return int Number of words */ function t5_word_count( $str … Read more

Order Posts by Alphabetical for Each Letter

This is what I find for this question. Two codes I found were coded by MichaelH from wordpress.org. Even he won’t probably see this post, I want to thank him. Now, I just need to sort these posts from specified one category. If anyone knows how to sort them with specified category, please help me. … Read more

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