Custom user data fields with WordPress Membership plugin

Here’s a quick overview of integrating custom user fields with Membership plugin (v2.0.7 at the time of writing).

Basically, we’ll have to:

  • Create some fields to be added after Membership’s own registration form
  • Create a function to validate and save the new registration form fields on submission
  • Copy-paste the whole user account edit form from Membership plugin and modify it to suit our needs
  • Create a function to override Membership’s own account edit form

WordPress Front Page vs Home Page and getting post ID outside or after the loop in every possible way

I was recently working on a site that needed to display the featured image of every page in its sidebar.

On regular, static pages or posts, everything works as intended – you can use is_page(), is_single() and get_the_ID() and not worry about anything.

// This works well on static pages or posts,
// displaying the featured image
if ( is_page() || is_single() ) {
    if ( has_post_thumbnail( get_the_ID() ) ) {
        the_post_thumbnail( 'full' );

However, on pages that contain the Loop (blog posts page, custom loop pages), things can get a bit complicated. I’ll walk you through a bunch of different solutions you can use to get the post/page ID, depending on the situation.

Continue reading