Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Ryan

    (@ryanmclaughlin1)

    Better to return early without any changes to avoid overwriting pagename…

    
    function _hashed_id_parse_request($qv) {
        if ( ! isset( $qv->query_vars['hashed_id'] ) ) {
            return $qv;
        }
    
        // ...
    
    Ryan

    (@ryanmclaughlin1)

    It is line 45 for me…

    Short term fix:

    Look in wp-content/plugins/wp-hashed-ids/wp-hashed-ids.php for the following line:

    $alphabet = (alpha_length >= $min_length || alpha_length < 16) ? $options['wp_hashed_ids_alphabet'] : '';

    And change both occurrences of alpha_length to $alpha_length.

    Just keep in mind any plugin updates will overwrite your changes.

    Thread Starter Ryan

    (@ryanmclaughlin1)

    Thanks Kathryn. I will keep an eye out for the next update!

    Thread Starter Ryan

    (@ryanmclaughlin1)

    Hey kathryn – yes, that is the icon i am talking about. That is very strange that it is working fine for you.

    I am working a local dev site so I don’t have a link to share at the moment.

    I did notice that the wp.org theme preview seems to be having the same problem, but the wp.com theme demo does not.

    Here is a gallery of everything i am seeing for reference: https://imgur.com/a/0i4l8

    Ryan

    (@ryanmclaughlin1)

    Yes you are absolutely right. I made some assumptions about load order in my first response but after taking a closer look class-wp-customize-manager.php isn’t included until the plugins_loaded hook. I will edit my previous to reflect this.

    edit: i guess i can’t edit old posts, so nevermind.

    Ryan

    (@ryanmclaughlin1)

    Hi giu1io – it looks like they did make some modifications to get_avatar in order to add the srcset attribute in 4.2.

    Additionally, in 4.1 they were using str_replace to swap out & # 0 3 8 ; with & a m p ;. They are no longer doing so.

    The reason the srcset and src values are different is that one is being escaped with the esc_url() function and the other is being escaped with the esc_attr() function. Both are technically correct.

    & # 0 3 8 ; and & a m p ; are just different references to the same character… you should be able to use them interchangeably.

    Do you have a specific case in mind where the url with & # 0 3 8 ; is not working correctly?

    Ryan

    (@ryanmclaughlin1)

    By default, the custom menu widget prompts you for a title and to select a menu. This is normal, your widget has not been hacked.

    You can create a new menu under appearance>menus and put any sort of links you want in it, give it a name, and then it will show up in the list of menus available to your widget.

    Ryan

    (@ryanmclaughlin1)

    Nilambar –

    I imagine this function is kept there because it is probably only used in core by the customizer.

    And the reason it is saying function not found is that this file is not included with every page request – only when you are actually in the customizer.

    The actual function is small and simple, so an easy fix would be to duplicate it in your theme/plugin wrapped in a function_exists check. This way it will always be available to you.

    So like this:

    if ( ! function_exists( 'sanitize_hex_color' ) ) {
        function sanitize_hex_color( $color ) {
            if ( '' === $color )
                return '';
    
            // 3 or 6 hex digits, or the empty string.
            if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
                return $color;
    
            return null;
        }
    }
    Ryan

    (@ryanmclaughlin1)

    This may be worth a read:

    Rewrite endpoints API

    Ryan

    (@ryanmclaughlin1)

    you might find this article helpful: https://ottopress.com/2010/dont-include-wp-load-please/

    Forum: Hacks
    In reply to: Don't trim space at the end
    Ryan

    (@ryanmclaughlin1)

    ok i think i understand better now.

    mndewitt: that was my original thought as well, but the problem is that when you are saving the option, the post data is trimmed directly before it is passed to update_option which in turn passes it to the sanitize callback. so the spaces will have already been removed by the time the callback runs. in fact, the callback is run on the same sanitize_option_{option-name} filter i mentioned previously.

    chris: another option to consider would be to hook in much earlier in the wp-admin startup process, verify that you are on options.php, that you are updating and check for your setting at $_POST[‘option-name’]. if it is set, then you can modify it directly, maybe surrounding it with quotes like mndewitt suggests or maybe replacing spaces with some sort of token such as %%SPACE%%.

    Forum: Hacks
    In reply to: Don't trim space at the end
    Ryan

    (@ryanmclaughlin1)

    Hey chris – i am not overly familiar with the setting api but from a quick look it seems as though options.php trims the option value before updating it, which means you may be out of luck.

    however you might be able to find a workaround – for example if the value is an array, it isn’t trimmed. or alternatively there are at least a couple of filters on the value after it has been trimmed but before it is saved such as pre_update_option_{option-name} and sanitize_option_{option-name}.

    hopefully this gives you some ideas on how to proceed.

    Ryan

    (@ryanmclaughlin1)

    if i am understanding you correctly, you want a google news feed on your site? not exactly wordpress specific, but i think i can help:

    at the bottom of any topic on news.google.com there should be a link to an rss feed. click it, copy the url and then paste it into a wordpress rss widget on your site.

    more info: https://support.google.com/news/answer/59255?hl=en

    Ryan

    (@ryanmclaughlin1)

    Chris – take a look at apply_filters, which essentially allows you to pass values back and forth, instead of do_action. it might look something like this:

    function auto_featured_image_from_title ($post_id) {
        // $auto_image_width = something
        // $auto_image_height = something
        $post = get_post($post_id);
        $new_featured_img = imagecreatetruecolor($auto_image_width, $auto_image_height);
    
        $new_featured_img = apply_filters('afift_after_image_created', $new_featured_img, $post_id);
    
        $newimg = $upload_dir['path'] . '/' . $post_slug . '.jpg';
        imagejpeg( $new_featured_img, $newimg );
    }
    function write_text($img, $post_id){
        // $post_id is available if you need it for anything...
        // $text_color = something
        // $font = something
        $text = 'Hello, my friend.';
        return imagettftext($img, 20, 0, 20, 20, $text_color, $font, $text);
    }

    hope it helps!

    add_filter('afift_after_image_created', 'write_text', 10, 2);

    Ryan

    (@ryanmclaughlin1)

    hello rauman – the form method is used to render the widget and by that point it is too late to enqueue scripts.

    try creating a separate method that gets hooked to admin_enqueue_scripts (https://codex.www.ads-software.com/Plugin_API/Action_Reference/admin_enqueue_scripts) and then register and enqueue your script from there.

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