I'm attempting to customize a wordpress theme. I've added custom field cp_job
with form submission. This indicates if the ad
is either Buyer
(Buying services) or Seller
(selling services), which is now complete.
Now I want to fetch results based on buyer
or seller
. In this wordpress theme classipress they have "Ads" on the side:
I simply want to fetch ads
which have the attribute buyer
or seller
, which I assume is under the MySQL column cp_job
. These ads will return the ad
with all columns. Doing this in native PHP and MySQL would be easy but working around this theme/wordpress is way more complicated as I don't understand WordPress syntax.
You can use wordpress custom query to fetch record from any table.Like
global $wpdb;
// return array of object
$dataArr = $wpdb->get_results(" SELECT col FROM table WHERE cond = data ");
Then you can do foreach on records like below:
foreach( $dataArr as $data ){
echo $data->col;
}
Hope this helps ;) Cheers!!!