• Resolved wsoftware

    (@wsoftware)


    I have problem ordering pages by title using following shortcode:

    [child_pages link_titles=”true” link_thumbs=”true” more=”Read more…” cols=”4″ thumbs=”true” words=”10″ orderby=”title”]

    The result is the same as if I would sort by page id:

    1. API Weinschel
    2. AR
    3. Cuming Microwave
    4. Emcore
    5. AmpliTech
    6. Beijing SAPS

    If I order by slug then it is more correct but I don’t understand why title is not working.

    https://www.ads-software.com/plugins/cc-child-pages/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Hi.

    I’ve tested the current version of the plugin on a test page, and can see no problems …

    I created pages named as per your list above (creating them purposefully out of order) and copied and pasted the shortcode from the above post to the parent page, and everything came out in alphabetical order as expected.

    Is the page you are having problems with available to view? If I could see the site, it might help me to understand what is happening.

    [ Signature moderated ]

    Thread Starter wsoftware

    (@wsoftware)

    The site is on address https://test-compomill.w-software.se (use password “Microwave2015”) and the page is “Manufacturers”.

    I can create a account for you if you want to have a look inside but then you have to send me a e-mail at [ redacted, support is not offered via email, Skype, IM etc. only in the forums ] to get login credentials.

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Hi.

    Just a quick update to let you know I am still working on this … I have not found the problem yet. As far as I can see, everything should work.

    I need to look into the other plugins that you are using to see how they may affect the query that gets the pages, so I am building a test environment with all the plugins you have installed currently to see if I can reproduce the problem.

    I suspect that the problem lies with qTranslate and how it stores the various translations for the title field (see https://wordpress.stackexchange.com/questions/123531/order-by-title-but-now-built-in-wordpress-func-sort-the-title) … but don’t wish to jump the gun and make assumptions at this point.

    If this does turn out to be the case, I will look into whether it is feasible to build in some kind of workaround (as I suspect that qTranslate is likely to be used by many sites). The answer given in the link above looks a bit inefficient to me, and I don’t want to impact sites that aren’t using qTranslate.

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    Hi again.

    Just a quick thought … it might just be easier to arrange the pages in the order that you want them to appear from the WordPress dashboard. The default sort order (menu order) will then be correct.

    A plugin such as Simple Page Ordering (https://www.ads-software.com/plugins/simple-page-ordering/) will help to make this easier to manage.

    [ Signature moderated ]

    Thread Starter wsoftware

    (@wsoftware)

    Yes, that is a possible work-around. I difficulty here is that vi have maybe 50-60 pages at the moment and maybe adding a 5-10 pages within a sort period.

    We could maybe use sort order 10, 20 and so on to be able to add pages in between. Hopefully you can fix this issue before we run in to bigger changes =)

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    OK.

    The problem is that the qTranslate-X plugin changes the data stored in WordPress’s ‘post_title’ field in the database.

    Every time you enter a translation for the content, both the ‘post_title’ and ‘post_content’ fields get updated.

    qTranslate stored ALL translations in the same field, encoded in a special format. Here is an example of the content of a multi-lingual Title field:

    [:en]Cotek[:fi]Cotek[:sv]Cotek (Svenksa)[:]

    Only the languages used are stored in the field, so another Title may be stored as:

    [:sv]AmpliTech[:]

    When my plugin (or any other plugin, widget or part of WordPress that uses WP_Query) requests the items are returned in alphabetical order, it will return then in the following order:

    1. [:en]Cotek[:fi]Cotek[:sv]Cotek (Svenksa)[:]
    2. [:sv]AmpliTech[:]

    … as [:en] is alphabetically before [:sv].

    I therefore have to say that the “problem” (if it is truly a problem) is with how qTranslate X is designed, as it stops standard WordPress functionality from working as expected.

    As a workaround, my previous suggestion is the best that I can presently offer. Using a drag and drop plugin to sort the pages, it should be very quick to do.

    Ensuring that translations are created in the same languages for each page would probably also work, as long as qTranslate X always puts the translations in the same order within the field.

    I am also looking into introducing a way of sorting using meta-data (custom fields), which may allow you to use a custom field to store the title for sorting.

    Thread Starter wsoftware

    (@wsoftware)

    Ok, that makes sense. We have to make it work until a new verison is out. Thanks for your time!

    Plugin Author caterhamcomputing

    (@caterhamcomputing)

    I am marking this topic as resolved, as it is a problem caused globally within WordPress by the qTranslate X plugin and not a bug with CC Child Pages.

    I have discovered a helpful fix which may help – see https://kuchenundkakao.wordpress.com/2015/02/09/mqtranslate-qtranslate-slug-qtranslate-fixing-the-orderby-title-problem/ … and have posted on the qTranslate X plugin support forum suggesting that they integrate it into their plugin to resolve the problem.

    I hope that CC Child Pages is still something you find useful, and that this extra information is helpful.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Orderby title’ is closed to new replies.