I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Plugin Overrides

dashed-slug.net Forums General discussion Plugin Overrides

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #3821
    alexg
    Keymaster

    Hi,

    Any reason I cannot override the views of the wallet in /my-child-theme/wallets/include/views. ?

    Thanks 🙂

    #3826
    alexg
    Keymaster

    Hello,

    Did you follow the instructions in the documentation about overriding the views directory?

    Instructions are given under “Frontend” -> “Frontend UI WordPress Filters” -> “Alternative knockout templates”.

    Essentially you need to use the wallets_views_dir filter to point to your new views directory.

    kind regards

    #3830
    alexg
    Keymaster

    I just saw it : function my_wallets_views_dir_override( $dir ) {
    return ‘/path/to/the/directory/where/the/new/templates/are/copied’;
    }
    add_filter( ‘wallets_views_dir’, ‘my_wallets_views_dir_override’ );

    My apologies ..

    #3831
    alexg
    Keymaster

    So, like this:

    function my_wallets_views_dir_override( $dir ) {
    return get_stylesheet_directory_uri() . ‘/wallets/include/views/’;
    }
    add_filter( ‘wallets_views_dir’, ‘my_wallets_views_dir_override’ );

    But you say:

    wp-content/plugins/wallets/includes/views/balance.php
    wp-content/plugins/wallets/includes/views/move.php
    wp-content/plugins/wallets/includes/views/deposit.php
    wp-content/plugins/wallets/includes/views/withdraw.php
    wp-content/plugins/wallets/includes/views/transactions.php

    Should this not be:

    wp-content/plugins/wallets/includes/views/balance/default.php
    wp-content/plugins/wallets/includes/views/move/default.php
    wp-content/plugins/wallets/includes/views/deposit/default.php
    wp-content/plugins/wallets/includes/views/withdraw/default.php
    wp-content/plugins/wallets/includes/views/transactions/default.php

    What about account value ?

    wp-content/plugins/wallets/includes/views/account_value/default.php

    Graeme

    #3832
    alexg
    Keymaster

    Yes thank you. I must update the documentation.

    These paths were from before each view got its own directory.

    Views now have their own directory so that they can have alternative templates.

    The correct paths are the longer ones.

    #3834
    alexg
    Keymaster

    But then what about the function:

    function my_wallets_views_dir_override( $dir ) {
    return get_stylesheet_directory_uri() . ‘/wallets/include/views/’;
    }
    add_filter( ‘wallets_views_dir’, ‘my_wallets_views_dir_override’ );

    ?

    #3835
    alexg
    Keymaster

    public function shortcode( $atts, $content = ”, $tag ) {
    $view = preg_replace( ‘/^wallets_/’, ”, $tag );

    $atts = shortcode_atts(
    array(
    ‘template’ => ‘default’,
    ‘views_dir’ => apply_filters( ‘wallets_views_dir’, __DIR__ . ‘/views’ ),
    ), $atts, “wallets_$view”
    );

    #3844
    alexg
    Keymaster

    I believe you were looking at an old version of the documentation. In the latest version 3.5.6 the paths are already up-to-date.

    wp-content/plugins/wallets/includes/views/balance/default.php
    wp-content/plugins/wallets/includes/views/move/default.php
    wp-content/plugins/wallets/includes/views/deposit/default.php
    wp-content/plugins/wallets/includes/views/withdraw/default.php
    wp-content/plugins/wallets/includes/views/transactions/default.php
    wp-content/plugins/wallets/includes/views/account_value/default.php

    What is your question about the functions you posted?

    #3847
    alexg
    Keymaster

    Nope:

    function my_wallets_views_dir_override( $dir ) {
    return get_stylesheet_directory_uri() . ‘/wallets/include/views/’;
    }
    add_filter( ‘wallets_views_dir’, ‘my_wallets_views_dir_override’ );

    I place list.php inside /wallets/includes/views/balance/ (in my child theme folder)

    does not work ..

    #3848
    alexg
    Keymaster

    Here’s some things that might help:

    1. Make sure you have the WordPress debug log enabled so you know what files the system looks for in case it cannot find them. You might need to debug the path.

    2. You can avoid hooking to the filter altogether, if you use the views_dir argument in your shortcode. This is implemented in 3.2.0 and is discussed in the documentation. It might allow you to do more tests quicker and easier.

    3. It could be some issue with the file permissions. Make sure that your files are readable by your webserver and that their directories are scannable (execute permission).

    4. You can, but you do not need the directory structure wallets/includes/views. Just call your directory anything, such as wallet_views.

    #3849
    alexg
    Keymaster

    Thanks Alex, will do and let you know. You have an account inside the system, when I’m done you should have a look 🙂

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.