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

Show chart in post using data passed as custom field

Welcome to WPSE. The first thing to note is that you may want to put any custom code you write for this functionality into a custom plugin. This way the functionality is theme independent and available to you even, if you someday change the theme you’re using. The modern way would be to create a … Read more

Show author post count in sidebar – Variable

To get the number of posts published by a user i found the solution was to call count_user_posts(), passing in the appropriate user id. <?php echo ‘Posts made: ‘ . count_user_posts( get_the_author_meta(‘ID’) ); ?> In translation ready form. <?php printf( ‘Posts made: %d’, count_user_posts( get_the_author_meta(‘ID’) ) ); ?> Storage in a variable. <?php $user_post_count = … Read more

Adding a Nav menu to post admin

To see how such a list can be created look at the code in wp-admin/includes/nav-menu.php. Unfortunately, it is hard coded there, so you have to re-create the code. First, let’s create two menus: We can get these menus in PHP with wp_get_nav_menus() (a wrapper for get_terms()): $menus = wp_get_nav_menus(); print ‘<pre>’ . htmlspecialchars( print_r( $menus, … Read more

How to remove_filter that filters iframes in posts? [duplicate]

This filter does not. This feature is disabled in the visual editor TinyMCE. function wpse49619_change_mce_options($initArray) { $ext=”iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]”; if ( isset( $initArray[‘extended_valid_elements’] ) ) { $initArray[‘extended_valid_elements’] .= ‘,’ . $ext; } else { $initArray[‘extended_valid_elements’] = $ext; } // maybe; set tiny paramter verify_html //$initArray[‘verify_html’] = false; return $initArray; } add_filter(‘tiny_mce_before_init’, ‘wpse49619_change_mce_options’); Also you can use examples … Read more

This AJAX Code Doesn’t Work – Looking for elegant solution

Working Code Based On My Previous Answer Without using nonce.. but you can check the previous answer on how you can implement a nonce check. And the code is based on your code. misha_my_load_more_scripts() in functions.php function misha_my_load_more_scripts() { wp_register_script( ‘my_loadmore’, get_stylesheet_directory_uri() . ‘/js/myloadmore.js’, array( ‘jquery’ ), ”, true ); wp_enqueue_script( ‘my_loadmore’ ); } add_action( … Read more

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