I’ve made an enhancement. On my sites this plugin now ignores “The” and “(The)” at the beginning of the Post Title. Posts are sorted based on the second word in the Title if they start with one of these articles.
This plugin is not being updated, but it is still useful. If you’d like a copy of my code, contact me or leave a message here.
]]>File list-posts-alphabetically.php is incorrectly handling a variable, and it’s throwing a PHP Warning and creating very large error logs. Three errors on each pass:
Illegal string offset 'category' in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 19
Cannot assign an empty string to a string offset in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 19
Illegal string offset 'category' in /home/AccountName/public_html/wp-content/plugins/list-posts-alphabetically/list-posts-alphabetically.php on line 24
Here is the code causing the warning:
function lpa_az_func( $lpa_az_atts ) {
var_dump($lpa_az_atts);
die("<BR><BR>X".$lpa_az_atts."Y");
$lpa_az_a = shortcode_atts( array(
'category' => '',
), $lpa_az_atts );
if (!isset($lpa_az_atts['category'])) {
$lpa_az_atts['category'] = '';
}
$lpa_az_args = array(
'numberposts' => 1000,
'category_name' => $lpa_az_atts['category'],
'orderby' => 'title',
'order' => 'ASC'
);
The problem is that $lpa_az_atts is being treated as an array, but it is merely a string variable.
Any chance this will be fixed in an upcoming update?
]]>