Setting up widgets in wordpress with a unique ID for the after_title argument

Looking at widget.php in trac sprintf() only runs on before_widget (Line 884): $params[0][‘before_widget’] = sprintf($params[0][‘before_widget’], $id, $classname_); Hence, it won’t work for any of the other arguments. I wondered whether you could use the dynamic_sidebar_params filter, but the $id and $classname_ arguments aren’t passed on to the filter. Outside of hacking core, I’m not sure … Read more

Row actions not showing? Why?

In display_rows() you are using the following code to print the ‘name’ column: echo ‘<td ‘.$attributes.’><strong><a href=”‘.$editlink.'” title=”Edit”>’.stripslashes($rec->name).'</a></strong></td>’; Nowhere do you call column_name(), which is the function you’ve defined to display the item’s and row actions: function column_name($item){ $actions = array( ‘edit’ => sprintf(‘<a href=”https://wordpress.stackexchange.com/questions/76517/?page=%s&action=%s&testimonial=%s”>Edit</a>’,$_REQUEST[‘page’],’edit’,$item[‘ID’]), ‘delete’ => sprintf(‘<a href=”https://wordpress.stackexchange.com/questions/76517/?page=%s&action=%s&testimonial=%s”>Delete</a>’,$_REQUEST[‘page’],’delete’,$item[‘ID’]), ); //Return the title contents return … Read more

Categories Template Assistance

Remove the cat parameter from your query and name your template file category.php From the WordPress Codex on Template Hierarchy; 1. category-{slug}.php – If the category’s slug were news, WordPress would look for category-news.php 2. category-{id}.php – If the category’s ID were 6, WordPress would look for category-6.php 3. category.php 4. archive.php 5. index.php The … Read more

Mail not sent when I set HTML headers

There’s the wp_mail() function in WordPress. The headers have to be added as array without trailing \n\r or similar. Example wp_mail( ‘[email protected]’, ‘Hello World!’, ‘Just saying…’, array( ‘MIME-Version: 1.0’, ‘Content-type: text/html; charset=iso-8859-1’, sprintf( ‘From: %s <no-reply@%s>’, get_bloginfo(‘name’), site_url() ), sprintf( ‘X-Mailer: PHP/%s’, phpversion() ), ) ); To change the content type you could as well … Read more

Limiting the WordPress feed to only a certain limit of characters

You can select between Full text and Summary in the Reading settings: If you select the Summary, then a) To control the number of words in the feed summary you can use: add_filter(‘excerpt_length’,’custom_excerpt_length’); function custom_excerpt_length( $num_words ){ return 30; // number of words to show } The default number of words in the summary is … Read more

Why do filters/actions require an argument count?

Because of backwards compatibility. You can use the same callback for multiple filters. Inside of that callback you should use current_filter() to determine the context. But some plugins use the number of passed arguments instead. Changing that would break these plugins. That’s why you should always use the API (here: current_filter()) and not some made-up … Read more