0

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 enter image description here

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.

Any help greatly appreciated, this is urgent. Can i have an example?

1 Answer 1

0

There is likely no "cp_job" column like you are thinking. extra data/information about a wordpress post type (it looks like ads is a custom post type here) would be stored as post meta in the database.

So you might see something in the wp_post_meta table like:

meta_id | post_id | meta_key | meta_value XX | XX | _cp_ad_type | buyer

Once you know the name of the meta key you are looking for, you can query for this data using a WP Query. Pay extra attention to the section called Custom Field Parameters which describes how to do a meta query

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.