Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter JarekM

    (@jmilewski)

    Hi @germankiwi,

    I looked into the “snippets” table that CodeSnippets adds to the WP database, and luckily the old descriptions are still there – the problem is that you can neither see nor edit them through the current admin interface. Let’s hope 2.8.6 comes soon…

    Thread Starter JarekM

    (@jmilewski)

    Wow! Perfect! I did not realise that a PHP constant can be defined in that way.

    This really adds another dimension to Code Snippets flexibility and I will keep on using the cookie-based solution for my own, but I fully agree it does not necessarily suit everyone.

    Thanks for the tip!
    — Jarek

    Thread Starter JarekM

    (@jmilewski)

    Yeah, SC 2.8.5.1, WP 4.7.4

    To be quite clear: the beauty of Code Snippets lies (among others) in the fact that they make 90% of such direct code modifications unnecessary.

    Unfortunately, not everything can be done with Code Snippets, so there is still room for manual interventions in the source code, which (of course) become a nightmare when the modified plugin or theme gets an update.

    Personally, I follow a convention of putting short marks (@@@ in my case) in all places I have modified, so with the use of some good search/compare program I can see if my corrections are still to be re-inserted after an update. (BTW, good general guidance on plugins modifications can be found here)

    So, in your case I would just do something like

    /* @@@
    $posts_number = (int) et_get_option( $shortname .
    ‘_woocommerce_archive_num_posts’, ‘9’ );
    */

    and hope I can spot the original place again after an update…

    Thread Starter JarekM

    (@jmilewski)

    Correction: $context is the 5th parameter, the 4th being $message_from __ which is also omitted in recover.php wppb_mail calls, but in this case the default null value is probably OK.

    @bungeshea, that’s probably an overkill, especially when the number of snippets goes beyond a single screen listing…

    In my view, it would be perfectly enough if you give the snippets an additional Order attribute (resulting in an extra integer column on the snippet listing) and make this attribute editable. This is how e.g. the Pages are ordered on the default WordPress pages listing.

    Then, to round up the whole thing, you could also provide an extra Settings option on the control panel, called e.g. “Default sorting order of the snippet list”, with a choice of ID / Name / Order.

    Dear @jkin,

    I think this forum is about the plugin, and not about errors in your own code. If everybody starts posting questions like “please find an error in this piece of program”, we will become a more luxury support site than ExpertExchange.

    — JM

    What regards re-ordering of the snippet list:

    The plugin provides a filter hook for the default sort order. If you would prefer e.g. “by name” instead of the default “by ID”, you need the following:


    function snippets_order(){ return 'name'; }
    add_filter( 'code_snippets/list_table/default_orderby', 'snippets_order' );

    And you can define it as a snippet!

    Thread Starter JarekM

    (@jmilewski)

    Hooray, works again! There was a moment when I was already “getting cold feet”, as the Germans say, but you fixed it really quickly.

    FYI: I am using “snippets” mostly for action hooks and filters, so that:

    1. I can switch them easily on and off, much like options
    2. This usually implements the customisable part of other plugins, if their authors were kind enough to provide action/filter hooks.

    You are certainly aware of all that stuff, it’s just to reassure you that what you are doing is important and useful.

    — Jarek

    Thread Starter JarekM

    (@jmilewski)

    Hi,

    WP 4.7.4, snippets 2.8.3, so both most up-to-date. I don’t remember the previous version, this was the today’s upgrade. As for now, all the snippets are working, but there is just a string “Network active” below each snippet name and there is no edit link.

    I deactivated all the other plugins, leaving only snippets active, did not help.

    Cheers — Jarek

Viewing 11 replies - 1 through 11 (of 11 total)