• Resolved girl_number_5

    (@trutherone)


    Hi,
    We’re Liking the new Prices & Purchase feature – would it be possible to allow for an alternative set of Purchase Text and Purchase links for certain tlds. Since we began using this plugin we’ve been updating your template directly to include a slight customisation link ‘trigger’, however your new purchase feature is pretty close to what we’ve been doing manually.

    Basically, I’ve created a link on the ‘success’ td row which when clicked triggers some jQuery its all client-side stuff after the ‘click’ event itself. This, i think, could now be implemented as alternative text & link. Its probably a big ‘ask’ since not many people would need this so as an alternative would it be more practical to provide some hooks so that we don’t need to continually edit the template files directly each time you update the plugin.

    Thanks in advance & keep up the good work!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP24

    (@wp24dotorg)

    As u stated this feature of an alternative set of price and link would not be used by many users. Therefore adding a hook would be the better solution.

    Something like this to manipulate the result on server side (e.g. in functions.php of the theme):

    function change_whois_result( $whois_result ) {
        if ( in_array( $whois_result->tld, array( 'com', 'net' ) ) ) {
    		$whois_result->price = '1.99 $';
    		$whois_result->link = 'https://www.ads-software.com';
    	}
        return $whois_result;
    }
    add_filter( 'wp24_domaincheck_whois_result', 'change_whois_result' );

    Since the domaincheck file for the ajax request uses only a short wordpress init, hooks are not possible. Hence a new option “Enable Hooks” could be added, so that the whole wordpress framework is loaded. This will slow down the whois requests a little bit.
    You colud test this removing the following line from assets/inc/domaincheck.php:
    define( 'SHORTINIT', true );

    If you are satisfied with this solution it could be added in the next version of the plugin.

    Thread Starter girl_number_5

    (@trutherone)

    Hi,
    That sounds good and I’ve just thought of another solution. Could you allow users to override template file in the plugin by copying the parent dir/file of ‘said’ file to the parent/child theme root so overriding the original files functionality. Not sure how its implemented; if its default behaviour in WP? – woocommerce do it a lot and other big players; Otherwise the hooks integration sounds great.

    Thanks

    Plugin Author WP24

    (@wp24dotorg)

    With the new version (1.4.2) you can enable hooks in the settings and manipulate the whois result as described in the code above.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom text and link’ is closed to new replies.