A density functional theory is proposed for an inhomogeneous hard-core Yukawa (HCY) fluid based on Rosenfeld's perturbative method. The excess Helmholtz energy functional is derived from a modified fundamental measure theory for the hard-core repulsion and a quadratic functional Taylor expansion for the long-ranged attractive or repulsive interactions. To test the established theory, grand canonical ensemble Monte Carlo simulations are carried out to simulate the density profiles of attractive and repulsive HCY fluid near a wall. Comparison with the results from the Monte Carlo simulations shows that the present density functional theory gives accurate density profiles for both attractive and repulsive HCY fluid near a wall. Both the present theory and simulations suggest that there is depletion for attractive HCY fluid at low temperature, but no depletion is found for repulsive HCY fluid. The calculated results indicate that the present density functional theory is better than those of the modified version of the Lovett-Mou-Buff-Wertheim and other density functional theories. The present theory is simple in form and computationally efficient. It predicts accurate radial distribution functions of both attractive and repulsive HCY fluid except for the repulsive case at high density, where the theory overestimates the radial distribution function in the vicinity of contact.