0

I am not really a developer, just can do bits and bobs and I am looking to change button text in a plugin but through a child theme.

What I've done is created the plugin folder structure as in original plugin and edited .php file in child theme. But it's not pulling through.

I am not sure if this is the way to do it - can someone help? This is the code I am looking to edit:

<input type="button" class="application_button button" value="<?php esc_attr_e( 'Apply for Job', 'wp-job-manager' ); ?>" />

I need to change "Apply for Job" to "Submit"

Full code in the original file is:

<?php if ( $apply = get_the_job_application_method() ) :
    wp_enqueue_script( 'wp-job-manager-job-application' );
    ?>
    <div class="job_application application">
        <?php do_action( 'job_application_start', $apply ); ?>

        <input type="button" class="application_button button" value="<?php esc_attr_e( 'Apply for Job', 'wp-job-manager' ); ?>" />

        <div class="application_details">
            <?php
                /**
                 * job_manager_application_details_email or job_manager_application_details_url hook
                 */
                do_action( 'job_manager_application_details_' . $apply->type, $apply );
            ?>
        </div>
        <?php do_action( 'job_application_end', $apply ); ?>
    </div>
<?php endif; ?>
  • Possible duplicate of override parent theme configuration in child functions.php – Jacob Peattie Nov 15 '18 at 13:11
  • The question isn't exactly the same, but my answer would be. You can't necessarily replace every theme file with a child theme. It depends on how the parent theme was built. There's a possibility that what you want to do is not possible. – Jacob Peattie Nov 15 '18 at 13:12
  • Sorry - the button I'm trying to change is actually in a plugin. I don't want to change the core plugin file though. Is there no way to achieve this without going down that road? – jadenew Nov 15 '18 at 14:49
  • Depends on the plugin. You'll need to check with the author if they support changing templates in any way. – Jacob Peattie Nov 15 '18 at 15:22
1

Generally speaking, you cannot change a plugin through a child theme, unless you use hooks the author has provided, or unless the author has allowed some of the plugin files to be overwritten.
However, as you only wish to change translatable text, you don't need any of this.

  • Install the plugin Loco Translate. Don't be scared, you won't actually be translating anything to another language - simply overriding the default translation files for the plugin.
  • Activate Loco Translate and go to Loco Translate->Plugins.
  • You will be presented with a list of plugins. Find the plugin that contains the text, click on it and then pick "Create Template".
  • Once it has been created go to "New Language" and create a template for the language you are using - if it's the default WP setup, this should be English(United States).
  • You will be redirected to the translation editor. There you will see all the plugin strings. Find the string you wish to change, change it (by adding a new text in the bottom box) and press "Save".

The above is a bit of a summary of how the plugin works. For more info about how to use Loco Translate: https://localise.biz/wordpress/plugin/manual/editor

  • Hi Bob, thank you so much for this suggestion - it sounds like an awesome and SUSTAINABLE solution. I have tested it and it works for some strings but not for other, so I will have to look into why that is, but I'm going to go with this. Thank you! – jadenew Nov 16 '18 at 12:49
  • Great, really glad I could help! – Bob Nov 16 '18 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.