Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying profile field name in Member Loop


  • ebraxton30
    Participant

    @ebraxton30

    I am trying to display the actual field name alongside the field in the member profile loop.

    I’ve used the following code to display the field:

    <?php bp_member_profile_data( ‘field=cancer type’ ); ?>

    Now I need to display the actual field name.  Can someone provide help with that?  One of our profile fields is Type of Cancer, but now all you see is “Breast” rather than Type of Cancer: Breast.

    Any thoughts?

Viewing 10 replies - 1 through 10 (of 10 total)

  • @mercime
    Keymaster

    @mercime

    Why not simply do something like this?

    `<p>Type of Cancer: <?php bp_member_profile_data( ‘field=cancer type’ ); ?> </p>`


    ebraxton30
    Participant

    @ebraxton30

    I copy pasted this code and it blanked out my page.  Could I be doing something wrong?


    ebraxton30
    Participant

    @ebraxton30

    I retyped it and it’s working.  I don’t know what was happening.  It went sort of wonky for a moment!

    Thanks so much for your help!

    One more question.  Is there a way to make the Type of Cancer portion bold so it stands out?


    @mercime
    Keymaster

    @mercime

    Surround Type of Cancer with opening `` and closing ``


    ebraxton30
    Participant

    @ebraxton30

    That worked!  Thanks so much.  Are text colors able to be affected here or no?  I’m thinking that it is still a little hard to distinguish so I’m wondering if I can make the field a gray.

    I really appreciate your help and quick response.


    @mercime
    Keymaster

    @mercime

    You can add inline style like `<p style=”color: #ccc;”>` or better yet, add a class `<p class=”crfield”>` then add p.crfield { color: #ccc} to your theme’s style.css file


    ebraxton30
    Participant

    @ebraxton30

    Great!  That worked perfectly.  I did the first option.  However, it moved the field to the next line.

    Is there a way to keep this from happening?  There is tons of space and it doesn’t need to be moved.

     

    This is how I set up the code:

    <p><strong>Type of Cancer: </strong><p style=”color: #736B6E;”><?php bp_member_profile_data( ‘field=Cancer Type’ ); ?></p>


    danbpfr
    Participant

    @chouf1

    p means paragraph, so it’s normal you have two lines instead one.

    Use span inside p

    <p><strong>Type of Cancer:&nbsp;</strong><span style=”color: #736B6E;”></span>&nbsp;<?php bp_member_profile_data( ‘field=Cancer Type’ ); ?></p>

    nbsp is a white space


    ebraxton30
    Participant

    @ebraxton30

    Thanks.  That appears to have helped with the line breaks but the color switched back to black.  Is there any way to get the color to change from here?

    Here is the link…

    Members


    @mercime
    Keymaster

    @mercime

    @ebraxton30

    `<p><strong>Type of Cancer:</strong> <span style=”color: #736B6E;”><?php bp_member_profile_data( ‘field=Cancer Type’ ); ?></span></p>`

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Displaying profile field name in Member Loop’ is closed to new replies.
Skip to toolbar