Results 1 to 6 of 6

Thread: Safe way to change text in layout

  1. #1
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts

    Safe way to change text in layout

    Hello, forum!

    I want to share a way as to change the text in the site layout - without changing ClassiPress files.

    This will avoid unnecessary work when you will upgrading ClassiPress!

    For example i want to replace text on button "Post an Ad" to "Post Your Property"
    and also change button text "Manage Ads" to "Dashboard"

    Ok, it's just examples!

    Let's see how to do it:

    PHP Code:
    function ohh_my_change_text$text ){

        switch ( 
    $text ) {

            case 
    'Post an Ad' // what we have
                
    $text 'Post Your Property'// what we want
                
    break;

            case 
    'Manage Ads' :
                
    $text 'Dashboard';
                 break;

            
    // this can be continued within reasonable limits
             /*case 'Email' :
                $text = 'Email Address';
                break;*/
        
    }

        return 
    $text;
    }
    add_filter'gettext''ohh_my_change_text'10 ); 
    Insert this into the file functions.php of your active theme or child theme.

    NOTICE: It will work only if original text wrapped into functions __(),_e(), _x(), etc.
    for example it will work with
    _e( 'Post an Ad', APP_TD ); - what we already changed.


    Agree, that it is much easier than looking for the text in the code and edit it manually after each update. Yes?

    Link to the documentation where i found it http://codex.wordpress.org/Plugin_AP...erence/gettext

    Any questions?

    Use and enjoy!

    Good Luck!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

  2. The Following 5 Users Say Thank You to dikiyforester For This Useful Post:

    buddb8706 (November 16th, 2013), mayed (February 15th, 2013), mzaha (February 15th, 2013), samcy (February 15th, 2013), talent (April 1st, 2013)

  3. #2
    samcy's Avatar
    Join Date
    Mar 2012
    Location
    Germany
    Posts
    12,098
    Thanks
    121
    Thanked 1,756 Times in 1,442 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Rolf Hassel (Samcy)

  4. The Following User Says Thank You to samcy For This Useful Post:

    dikiyforester (February 15th, 2013)

  5. #3
    Senior Member binh's Avatar
    Join Date
    Aug 2011
    Location
    Finland
    Posts
    170
    Thanks
    17
    Thanked 11 Times in 9 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #4
    saml's Avatar
    Join Date
    Mar 2013
    Location
    Barbados
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #5
    bentan's Avatar
    Join Date
    Mar 2013
    Location
    Singapore
    Posts
    23
    Thanks
    3
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    arthemes.org - AppThemes plugins, tutorials, modifications and services

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Layout change homepage
    By orangemedia in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: May 29th, 2012, 10:58 AM
  2. change single ad listing layout
    By pankaj in forum ClassiPress General Discussion
    Replies: 2
    Last Post: October 8th, 2011, 03:55 AM
  3. change layout of page
    By pankaj in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: September 28th, 2011, 01:48 AM