This topic has 6 replies, 4 voices, and was last updated 10 years by Abe.

  • Author
  • #9730
     Leap-it
    Participant

    is there a way to change the profil colors (background, buttons, text …….) depending on gender ?

    thanks

    #9810
     Abe
    Keymaster

    Hello,
    This code added to sweetdate-child/functions.php will add a class to the body tag with the specific value of user, eq: man and after that you just need to add you CSS rules accordingly for each class eq. body.man #header {color: blue;}

    COPY CODE
    
    /*
     * Adds some required body claasses
     */
    add_filter('body_class','kleo_body_my_classes');
    
    /**
     * Adds specific classes to body element
     * @param array $classes
     * @return array
     * @since 2.1
     */
    function kleo_body_my_classes($classes = '') {
    	global $bp;
    	if (is_user_logged_in()) {
    		$data = bp_get_profile_field_data( 'field=I am a&user_id=' . $bp->loggedin_user->id );
    		$classes[] = strtolower(str_replace(' ', '-', $data));
    	}
    	return $classes;
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #10214
     whinds
    Participant

    Also how do i display another field above the the Age / City (ie man or woman, marrried or single)?

    #10406
     Abe
    Keymaster

    Hi, Please see this topic for the fields that appear on that line
    https://archived.seventhqueen.com/forums/topic/member-directory-page-about-me-text-does-not-display

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #10438
     whinds
    Participant

    ok thanks.

    #18457
     Graphikom
    Participant

    Hello,

    I’m sorry but I don’t andestand.
    I add your code in function.php of sweetdare-child
    Where I create the CSS Classes ? And how ? I’m sorry I’m a French newby 🙂

    THE CODE :
    * Adds some required body claasses
    */
    add_filter(‘body_class’,’kleo_body_my_classes’);

    /**
    * Adds specific classes to body element
    * @param array $classes
    * @return array
    * @since 2.1
    */
    function kleo_body_my_classes($classes = ”) {
    global $bp;
    if (is_user_logged_in()) {
    $data = bp_get_profile_field_data( ‘field=I am a&user_id=’ . $bp->loggedin_user->id );
    $classes[] = strtolower(str_replace(‘ ‘, ‘-‘, $data));
    }
    return $classes;
    }

    #18712
     Abe
    Keymaster

    Hi @Graphikom
    You need basic PHP, HTML, CSS knowledge to make specific edits. That code will add some classes to the body tag depending on your profile values user saved for the “I am a” field.
    Inspect elements in your browser with Chrome Inspect element tool

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?