Device-to-device (D2D) communications is seen as a major technology to overcome the imminent wireless capacity crunch and to enable novel application services. In this paper, we propose a novel, social-aware approach for optimizing D2D communications by exploiting two network layers: the social network and the physical, wireless network. First we formulate the physical layer D2D network according to users encounter histories. Subsequently, we propose a novel approach, based on the so-called Indian Buffet Process, so as to model the distribution of contents in users online social networks. Given the online and offline social relations collected by the Evolved Node B, we jointly optimize the traffic offload process in D2D communication. Simulation results show that the proposed approach offload the traffic of Evolved Node B successfully.