• Resolved DjPD

    (@djpd)


    Hi,
    I would like to create an A-Z list. If I enter the shortcode

    [catlist name="recipe" orderby=title order=asc starting_with="a" post_type="post" numberposts=-1]
    or
    [catlist name="recipe" starting_with="a" post_type="post" numberposts=-1]

    , then comes the following error message.

    Warning: strtoupper() expects parameter 1 to be string, object given in ...../lcp-parameters.php on line 306

    What can I do against it?
    All other shortcodes works.

    • This topic was modified 6 years, 11 months ago by DjPD.
    • This topic was modified 6 years, 11 months ago by DjPD.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    Hi @djpd

    It means there is an error when the plugin tries to get the character set of your database tables.

    The quick way to fix this is to try passing the character set manually, instead of figuring out where this error really comes from.

    Add this to your child theme‘s functions.php:

    function my_set_db_charset( $charset, $table, $column ) {
        if ('wp_posts' === $table && 'post_title' === $column) {
            return 'utf8mb4';
        }
    }
    add_filter('pre_get_col_charset', 'my_set_db_charset', 10, 3);

    It will tell the LCP plugin it should use the utf8mb4 character set. If this doesn’t work try utf8 instead.

    Let me know of the result.

    Thread Starter DjPD

    (@djpd)

    Thank you for your help.
    The error message is no longer displayed. However, the site does not show me any results.
    I have a Parent Category and would like to have all the articles with the first letters A, B, C, etc. displayed. So I have a main category, which also includes subcategories. And I want all the articles (main and sub-categories) to be displayed. Subcategories should also be considered.
    Is that possible?
    I once tried [catlist name="Sub Category" orderby=title order=asc starting_with="a" post_type="post, recipe" numberposts=-1] , but to no avail.

    Is there a trick or do you have a tip, which I could try.
    I would like to display all articles in alphabetical order. But with the shortcode the page shows nothing to me. But I have articles with the initials “A”.

    Plugin Contributor zymeth25

    (@zymeth25)

    First of all please make sure you have latest versions of WordPress and List Category Posts.

    I am not sure I understand what you mean. Some things I will clarify:

    • When you select a category, e.g. name="My Category", the LCP plugin will automatically display posts from the category’s sub-categories
    • If you want to display posts alphabetically, you don’t need starting_with, the plugin displays posts alphabetically by title by default
    • If you use starting_with, the plugin will only display posts which have a title that begins with the character you specified

    Try your shortcode without starting_with and see if it works. Since we already know there are some database issues with your WordPress installation, it might be difficult to get it working (if you really need it).

    • This reply was modified 6 years, 11 months ago by zymeth25.
    • This reply was modified 6 years, 11 months ago by zymeth25.
    Thread Starter DjPD

    (@djpd)

    Many Thanks.
    I just tried [catlist starting_with = “a”], also different variants with name, etc.
    But nothing is displayed to me.

    I wanted to display an alphabetical list. Additional HTML code between the letters.

    <div class = "bigaplha"> A </ div>
    A Titel1
    A title2
    A Share3
    <p class = "up"> & lt; <a href="#uptostart"> up </a> & gt; </ p>
    <div class = "bigaplha"> B </ div>
    B-Titel1
    B-title2
    B-Share3

    But that is not possible with the normal shortcode, right?

    I’ve always thought that it would be best to select and display each article with a first letter. These are of course many requests, but I do not know how to do it better. Except maybe with its own function or something. Then I could first read out all the articles in the category and then simply spend and write something in between each letter jump.
    But I think I can not do that yet.

    Plugin Contributor zymeth25

    (@zymeth25)

    Try using utf8 instead of utf8mb4 in the code I gave you.

    If neither work then I’m afraid starting_with won’t work on your WordPress installation because of unexpected database setup.

    You could try reinstalling WordPress afresh with the most recent version if you want to go further with debugging this.

    Plugin Contributor zymeth25

    (@zymeth25)

    Hi, you might want to check the latest plugin version, we changed starting_with a bit, maybe it solves your issue.

    Cheers

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Problem with starting_with=” “’ is closed to new replies.