Support

Account

Home Forums General Issues AWESUM!

Solving

AWESUM!

  • …but I need help, if it’s even possible, creating a “Members List” page.

    I’ve created some custom fields for my WP user profile page but was hoping there were maybe shortcodes or something I could use to populate a page to create a member listing. The listing would show the members avatar/photo, name and other fields already populated in their profile.

    Any ideas?

    And thanks for an awesum plugin!

  • Check that: http://www.advancedcustomfields.com/resources/shortcode/

    But if I were you I would not use shortcode. Instead, I will create the author template in my custom theme (author.php) and populate it with the needed fields.

  • Okay I’m not PHP savvy. I can see how the author page is created but then how does this page get seen on the front-end of the Website?

  • This is not related with Php, but with the template hierarchy in WordPress.
    You need to understand how WordPress works and how to develop a theme to do so.

    I’m not sure if you are talking about the WordPress’ users or you are asking about a custom members listing. If it is the second choice it will be good to take a look at how to create a custom post type (members) and how to build the front-end page for it (archive-members.php and single-members.php).

    Those are just cue, since I cannot explain everything about WordPress here.

  • Yup I wanted to pull from the user profile and populate a page that list all members and the custom fields I created with ACF. It’s for a cycling instructor club and I needed to show the status (current/expired) of their credentials.

    Thanks.

  • I found this page (http://www.elliotcondon.com/using-the-advanced-custom-fields-plugin-to-create-a-custom-home-page-in-wordpress/) and am trying to use it to get something going on my own.

    Unfortunately, midway down the author is referencing a link under “Building the Home Page template” that no longer exists (http://plugins.elliotcondon.com/advanced-custom-fields/code-examples/).

    Anyone know if this page still exists?

  • The Home page default template is the home.php located in your custom theme directory. If it doesn’t exists, just create that file with the proper name “home.php”. Otherwise, you can create a custom template with whatever name (except those reserved by the WordPress hierarchy, but you need to make that file a template), create a page in the WordPress admin which will use that template and then configure WordPress to display that static page as the home page.

    Other reference which could be useful: http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-homepage-in-wordpress/

    But you want your home page to display the users list showed with their related ACF custom fields, that’s it?

  • Hey Etic thx for the suggestions.

    I don’t want to use the Home page. I will be creating an “Instructor” page. That is where I need to show the User list with ACF data. So one line for example would display:

    Instructor Name > Contact info > Years of experience > Credentials

    Of course the page would be populated with all instructors but that’s how I see each line appearing.

    Basically. I’m still working on the layout.

    I just came across that tutorial in which the author was creating a home page and thought I could piece together something using his methods. I’m a PHP noob so I’m still figuring out how to start with this. But I don’t mind learning as long as the instructions are clear and make sense.

  • Ok, sounds better.
    Here is some code (with no html format) to help you sort this out:

    
    <?php
    $args = array(
    	'orderby'=>'nicename', 
    	'role'=>'subscriber'
    );
    
    $users = get_users( $args );
    
    foreach ( $users as $user ) {
    	print($user->display_name);
    	the_field('years_of_experience', 'user_'.$user->ID);
    	the_field('credentials', 'user_'.$user->ID);
    }
    ?>
    
    

    The role must be the one your Instructors will get.

    You need to put that in a template (author.php or a page template) in your custom theme.

    Useful references:

  • Etic thank you sooooooooooooo much – that actually works. Of course. Needs some styling but dang!

    Okay I’m really not trying to wear out my welcome, but right now I’ve got an issue that I have no idea how to resolve.

    I created one field like this:

    #1
    Label = Credentials
    Type = Radio button (current/expired)

    #2
    Label = Credentials Expired Date
    Type = Date picker
    Conditional logic is applied if #1 is set to Expired

    During the first test, the page displayed:
    instructor name > Current

    Awesum!

    During the next test I set #1 to expired and the date picker appeared as it should. I set the date to sometime last year.

    Refreshed the page and the page displayed:
    instructor name > Expired20130801 (as I mentioned I need to add some styling so disregard the layout)

    During the next test I set #1 back to Current and the page displayed:
    instructor name > Current20130801

    Uh-oh!

    So even if I select the radio button “Current” the instructor profile stills displays a date.

    I’m guessing something needs to tell something else to refresh or flush so the date only displays if #1 is set to expired???

  • That is because on the site side, ACF will not apply the conditional logic (only in the admin side). You need to do it by “yourself” using normal PHP condition, just like this:

    if (get_field('credentials') == 'expired') the_field('credentials_expired_date');

    This way, the credentials expired date will only be displayed if the credentials field is set to ‘expired’.

    ACF is not applying the condition when displaying the data on the site and it is perfect like this. It is up to you (your code, I mean) to choose if you want or not to display that date (also, the ACF conditional logic doesn’t affect if the ‘credentials_expired_date’ is stored or not, it is only affecting the displaying of the field in the admin area).

  • Etic your code did not work. It was still not outputting the expiration date when Credentials was set to expired.

    As I mentioned I’m barely a novice at PHP. After some hours using Google I was able to modify what you gave me into this, and it appears to work:

    <?php
                $args = array(
                    'orderby'=>'nicename',
                    'role'=>'instructor'
                );
    
                $users = get_users( $args );
    
                foreach ( $users as $user ) {
                    print($user->display_name);
                    the_field('credentials', 'user_'.$user->ID);
                    if (get_field('credentials', 'user_'.$user->ID) == 'expired')
                    the_field('credentials_expired_date', 'user_'.$user->ID);
                    the_field('background_check_status', 'user_'.$user->ID);
                    echo '<br/>';
                }
                ?>

    As I add more fields using ACF I’d like to copy/paste/modify so as to output those fields too. But because it appears different than what you suggested, could you confirm this is correct coding?

    My page output now for Credentials current & Background expired is (still needs CSS):

    Lisa RhodescurrentExpired

    Output for Credentials expired & Background current:

    Timmy Biggsexpired20130802Current

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

The topic ‘AWESUM!’ is closed to new replies.