Forum Replies Created

Viewing 15 replies - 1 through 15 (of 43 total)
  • Thread Starter Radovan Smitala

    (@adorei)

    Hi @mguenter

    sadly without access to original code I am not able to “change” or create pull-request for such kind of feature.

    So maybe in the future somehow ??

    R.

    Thread Starter Radovan Smitala

    (@adorei)

    Hi Matthias!

    Yes, maybe I was too vague and my point was unclear about menu_order. Sorry for that ??

    It looks like it is as you are saying with QuickEdit
    post_parent is always set, so menu_order is within that node scope.

    Yeah, I know what you mean. This is because menu_order is simply used as the position for the current scope (post_parent). We do not currently change the post_parent if you move a post via drag & drop, we simply update the menu_order. In other terms, we need to introduce a new drag & drop experience to also move the posts horizontally, not only vertical. Do you know what I mean?

    Maybe I understand. By XHR request I see that you are sending only sequence collection of IDs and based on that collection and position within collection is menu_order updated for every post id.

    As my first part of comment: I think menu_order should be ordered only within node scope and must not be able to move-out of scope. To increase UX.

    Is a somewhere public repository for this plugin? Just to check and maybe open PR ??

    Thread Starter Radovan Smitala

    (@adorei)

    Hi @mguenter!

    I tried to find where is the documentation page for behavior that you explain. I didn’t find any. Can you help me?
    Cause I think this is very variable.

    Second part of your comment is correct. Maybe parent should not be changed when I am changing position within scope.

    Regards,
    Radovan

    Thread Starter Radovan Smitala

    (@adorei)

    You are welcome.

    Thank you for such great work for community!

    This module don’t check any capabilities. Everyone should replace media with capability upload_files.

    Hope you are kidding. Is this module opensource, need a PR ASAP.

    Thread Starter Radovan Smitala

    (@adorei)

    OK, reediting doesnt work well. Post types are dissapearing in administration. Maybe changind some arguments after redgistering. I have find easier solution available by WP 4.4.

    Filters:

    register_post_type_args and register_taxonomy_args

    It should looks like this. it is my partial partial implementation so you need to change some variables:

    
    $prettyPostTypeLinks = ['post_type_name' => 'nice-url'];
    $prettyTaxonomyLinks = ['taxonomy_name' => 'nice-category-url'];
    
    add_filter('register_post_type_args', function ($args, $post_type) use ($prettyPostTypeLinks) {
        $newRewrite = [
            'slug' => $prettyPostTypeLinks[$post_type]
        ];
    
        if ($args['rewrite'] === true || $args['rewrite'] === 1) {
            $args['rewrite'] = $newRewrite;
        } else {
            $args['rewrite'] = array_merge($args['rewrite'], $newRewrite);
        }
    
        return $args;
    }, 10, 2);
    
    add_filter('register_taxonomy_args', function ($args, $taxonomy) use ($prettyTaxonomyLinks) {
        $newRewrite = [
            'slug' => $prettyTaxonomyLinks[$taxonomy]
        ];
    
        if ($args['rewrite'] === true || $args['rewrite'] === 1) {
            $args['rewrite'] = $newRewrite;
        } else {
            $args['rewrite'] = array_merge($args['rewrite'], $newRewrite);
        }
    
        return $args;
    }, 10, 2);
    
    Thread Starter Radovan Smitala

    (@adorei)

    OK, i don’t make deep diving into WPML how it replace slug, but i make working solution:

    
    class RewriteHelper
    {
        public static function prettifyPostTypeLinks($postType, $slug)
        {
            $postTypeObject = json_decode(json_encode(get_post_type_object($postType)), true);
    
            $newRewrite = [
                'slug' => $slug
            ];
    
            if ($postTypeObject['rewrite'] === true) {
                $postTypeObject['rewrite'] = $newRewrite;
            } else {
                $postTypeObject['rewrite'] = array_merge($postTypeObject['rewrite'], $newRewrite);
            }
    
            register_post_type($postType, $postTypeObject);
        }
    
        public static function prettifyTaxonomyLinks($taxonomy, $slug)
        {
            $taxonomyObject = json_decode(json_encode(get_taxonomy($taxonomy)), true);
    
            $newRewrite = [
                'slug' => $slug
            ];
    
            if ($taxonomyObject['rewrite'] === true) {
                $taxonomyObject['rewrite'] = $newRewrite;
            } else {
                $taxonomyObject['rewrite'] = array_merge($taxonomyObject['rewrite'], $newRewrite);
            }
    
            register_taxonomy($taxonomy, $taxonomyObject['object_type'], $taxonomyObject);
        }
    }
    

    Disadvantage of my solution is that rewrite links are generated twice. First with initial registration of CPT or Tax and second one as changing rewrite slug.

    Links are multiplied also in “registered_post_type” or “registered_taxonomy” action hooks.

    Thread Starter Radovan Smitala

    (@adorei)

    I don’t know how complicate it should be, but i am trying to do like this:

    1. get post type with “get_post_type_object”
    2. override rewrite part where slug be defined by custom string
    3. use again “register_post_type” to override it

    similar for “register_taxonomy”

    Can’t say how to WPML do that, but it allows change rewrite slug.

    I will give results how it it works.

    Update!!

    It removes Endpoint because duplicates it to database! After duplication it saved to database empty value for endpoint.

    I dont know why, but WPML plugin is very handy, but also code *rap

    Woocommerce WPML have problem with endpoints.

    When ISN’T endpoint translated Woocommerce doesnt use default (eg. EN) but removes this endpoint with empty string.

    For example:

    Original (English) url is
    https://kattivatrends.com/checkout/order-pay/2265?pay_for_order=true&key=wc_order_569823d9ea112

    but when endpoint for Paying order is not translated. It removes url element: (Slovak)

    https://kattivatrends.com/pokladna//2263?pay_for_order=true&key=wc_order_56981e0fd3b12

    After translating endpoint in WPML String, everything work again.

    WPML 3.3.5,
    Woocommerce 2.4.13,
    Woocommerce Multilingual 3.7.7

    I think same override do Woocommerce when is option “Force secure checkout” is enabled, so when website uses default only HTTP version its overload WP_HOME and WP_SITEURL. Because if it dont do it, page will dont load CSS and JS files.

    If it isnt standard configuration then i dont know why WordPress has helper function is_ssl(). I think it is completely normal, because you could conditional content.

    Wordfence Basic Cache handles SSL and NON-SSL right. It saves and returns two diffrerent results. One for HTTP and for HTTPS.

    Only Falcon engine uses just one cache file. (same for HTTP and HTTPS) so when is HTTP cached first, on HTTPS version it returns this HTTP cached file with bad content (URLs are non secure for example) and it is error.

    Hi,

    im using version 6.0.7 and i think Wordfence has problem with HTTP vs HTTPS.
    Wordfence returns for both protocol same cached content. What is problem, because there are two different URL and need be two different cache content. Option “Allow SSL” in Performance tab is disabled. But i

    My main url is HTTP but i have available HTTPS because Google.
    I change flow how WordPress handles SITE_URL constant. In wp-confing.php add this conditionals:

    if (isSecure()) {
      define('WP_HOME',   'https://' . $web_site_url);
      define('WP_SITEURL','https://' . $web_site_url);
      header( 'X-Secure-Connection: true' );
    } else {
      define('WP_HOME',   'https://' . $web_site_url);
      define('WP_SITEURL','https://' . $web_site_url);
    }

    So when somebody (or Google crawler) use https, all my links are changed to secure.
    But if is only one version cached, it returns bad links (http in https content, so CSS and Scripts are not loaded).

    I think Falcon engine should cache HTTP and HTTPS separately but it doesn’t

    Regards!
    Radovan.

    Hi,

    this is quick fix for custom post type slug:

    in file CPTP/Module/Permalink.php
    on line about 49 replace this:

    $permalink = str_replace( '%'.$post_type.'_slug%', get_post_type_object( $post_type )->rewrite['slug'], $permalink );

    with this:

    $permalink = str_replace( '%'.$post_type.'_slug%', WPML_Slug_Translation::get_translated_slug(get_post_type_object( $post_type )->rewrite['slug'], ICL_LANGUAGE_CODE), $permalink );

    I don’t know where you INSERT or UPDATE sql data, but i test it on mysql 5.6 with strict mode defined. Before this change no data was written. That was all columns are defined as NOT NULL, and there is statement in INSERT where one column is not defined, so data can’t be inserted, because are invalid for schema.

    Change “name” column to be NULLable and everything will be fine.
    By documentation https://dev.mysql.com/doc/refman/5.5/en/sql-mode.html#sql-mode-strict is not necessary to change PHP code, only SQL schema, because if column in insert statement missing, NULL are defined by default.

    R.

    If you can’t disable strict mode (shared hosting) do this simple two actions:

    1. In datbaase table wp_dynamic_widgets define column name to allow be NULL

    2. in file dynwid_class.php (path: dynamic-widgets/classes/) about line 217 is method:
    public function addSingleOption

    just change SQL INSERT statement to this:

    $query = “INSERT INTO ” . $this->dbtable . “
    (widget_id, maintype, name, value)
    VALUES
    (‘” . esc_sql($widget_id) . “‘, ‘” . esc_sql($maintype) . “‘, NULL, ‘” . esc_sql($value) . “‘)”;

    Columns which must not have content, their must be allow to have NULL value, define that is really empty! Not only empty string.

Viewing 15 replies - 1 through 15 (of 43 total)