Viewing 13 replies - 1 through 13 (of 13 total)
  • @jade,

    There is a filter hook (API) that allows you to do this with a little bit of code, either as a new plugin or in your themes functions.php file. Subscribe2 hooks are documented here:

    http://subscribe2.wordpress.com/support/api/

    I’ve just added the ‘s2_subscribe_button’ and ‘s2_unsubscribe_button’ hooks to the list, they are the ones you need.

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    every time i add the following hook to my functions file the site white screens please advise where I’m going wrong I’m using the following

    function change_subscribe_button_text() {
        // return your preferred button text
        return “My Preferred Button Text”;
    }
    add_action(‘s2_subscribe_button’, ‘change_subscribe_button_text’);

    @jade,

    Sorry, it should be add_filter, not add_action. Try this:

    function change_subscribe_button_text() {
        // return your preferred button text
        return "My Preferred Button Text";
    }
    add_filter('s2_subscribe_button', 'change_subscribe_button_text');

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    i put in the following

    function change_subscribe_button_text() {
    // return your preferred button text
    return “My Preferred Button Text”;
    }
    add_filter(‘s2_subscribe_button’, ‘Yes_Please’);

    and now I’m getting

    function change_subscribe_button_text() { // return your preferred button text return “My Preferred Button Text”; } add_action(‘s2_subscribe_button’, ‘Yes_Please); this in my header

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    as well as the button text doesn’t change

    @jade,

    You have put the code outside the PHP tags so it’s being treated as text.

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    sorry i don’t understand what you mean which php tags would you like the text out side of ?

    @jade,

    PHP tags are <?php to open and ?> to close. All PHP statements need to be inside a set of these tags. I think you have added thrice after a closing PHP tag. Move the code before it.

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    yes I know what a php tag is but I’m unsure where it supposed to be placed with in this example bellow i have placed the code with in the functions.php folder as per bellow please confirm where I’m going wrong

    function change_subscribe_button_text() {
    // return your preferred button text
    return “My Preferred Button Text”;
    }
    add_filter(‘s2_subscribe_button’, ‘change_subscribe_button_text’);

    @jade,

    Okay, so your functions.php file should have at the very least an opening PHP tag and maybe a closing one. Yours almost certainly has a closing tag or you wouldn’t see this issue. Place the code above at the end of any existing code in your functions.php file but before the closing PHP tag. There is no need to add more opening and closing PHP tags.

    Thread Starter jade.stewart

    (@jadestewartgmailcom)

    the code is inside a php tag see bellow

    <?php
    
    /*-----------------------------------------------------------------------------------*/
    /* Start WooThemes Functions - Please refrain from editing this section */
    /*-----------------------------------------------------------------------------------*/
    
    // Set path to WooFramework and theme specific functions
    $functions_path = get_template_directory() . '/functions/';
    $includes_path = get_template_directory() . '/includes/';
    
    // Don't load alt stylesheet from WooFramework
    if ( ! function_exists( 'woo_output_alt_stylesheet' ) ) {
    	function woo_output_alt_stylesheet () {}
    }
    
    // Define the theme-specific key to be sent to PressTrends.
    define( 'WOO_PRESSTRENDS_THEMEKEY', 'tnla49pj66y028vef95h2oqhkir0tf3jr' );
    
    // WooFramework
    require_once ( $functions_path . 'admin-init.php' );	// Framework Init
    
    if ( get_option( 'woo_woo_tumblog_switch' ) == 'true' ) {
    	//Enable Tumblog Functionality and theme is upgraded
    	update_option( 'woo_needs_tumblog_upgrade', 'false' );
    	update_option( 'tumblog_woo_tumblog_upgraded', 'true' );
    	update_option( 'tumblog_woo_tumblog_upgraded_posts_done', 'true' );
    	require_once ( $functions_path . 'admin-tumblog-quickpress.php' );  // Tumblog Dashboard Functionality
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* Load the theme-specific files, with support for overriding via a child theme.
    /*-----------------------------------------------------------------------------------*/
    
    $includes = array(
    				'includes/theme-options.php', 				// Options panel settings and custom settings
    				'includes/theme-functions.php', 			// Custom theme functions
    				'includes/theme-actions.php', 				// Theme actions & user defined hooks
    				'includes/theme-comments.php', 				// Custom comments/pingback loop
    				'includes/theme-js.php', 					// Load JavaScript via wp_enqueue_script
    				'includes/theme-plugin-integrations.php',	// Plugin integrations
    				'includes/sidebar-init.php', 				// Initialize widgetized areas
    				'includes/theme-widgets.php',				// Theme widgets
    				'includes/theme-advanced.php',				// Advanced Theme Functions
    				'includes/theme-shortcodes.php',	 		// Custom theme shortcodes
    				'includes/woo-layout/woo-layout.php',		// Layout Manager
    				'includes/woo-meta/woo-meta.php',			// Meta Manager
    				'includes/woo-hooks/woo-hooks.php'			// Hook Manager
    				);
    
    // Allow child themes/plugins to add widgets to be loaded.
    $includes = apply_filters( 'woo_includes', $includes );
    
    foreach ( $includes as $i ) {
    	locate_template( $i, true );
    }
    
    // Load WooCommerce functions, if applicable.
    if ( is_woocommerce_activated() ) {
    	locate_template( 'includes/theme-woocommerce.php', true );
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* You can add custom functions below */
    /*-----------------------------------------------------------------------------------*/
    function change_subscribe_button_text() {
        // return your preferred button text
        return "My Preferred Button Text";
    }
    add_filter('s2_subscribe_button', ‘Yes_Please’);
    
    /*-----------------------------------------------------------------------------------*/
    /* Don't add any code below here or the sky will fall down */
    /*-----------------------------------------------------------------------------------*/
    ?>

    @jade,

    You code is inside the tag, but you code is wrong. you have created a function called ‘change_subscribe_button_text’ and that should be added as the filter rather than you ‘Yes Please’.

    If you want ‘Yes Please’ returned you need to put that in the quotes instead of “My Preferred Button Text”.

    The code you need to insert is:

    function change_subscribe_button_text() {
        // return your preferred button text
        return "Yes Please";
    }
    add_filter('s2_subscribe_button', 'change_subscribe_button_text');
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘change button text’ is closed to new replies.