Placeholders (also known as Field Codes) are special words that you can use in the Singe Ad layout and Listings layout settings to show information about your Ads. They take this format: $PlaceholderName and they help you to customize the look and feel of your ads.
This article contains the most current list of placeholders you can use in your ads:
Codes for the Single Ad Page Layout
$ad_title
$featureimg
$codecontact
$adcontact_name
$aditemprice
$adcontactphone
$adcontactemail
$awpcpextrafields
$awpcpvisitwebsite
$showadsense1
$addetails
$showadsense2
$awpcpshowadotherimages
$awpcpadviews
$showadsense3
$ad_startdate
$ad_postdate
$ad_categoryurl
$ad_categoryname
$location
$city
$state
$country
$village
$county
$region
$url
$title
$website_url
$website_link
$category_url
$category_name
$contact_url
$contact_phone
$contact_name
$details
$price
$thumbnail_width
$featured_image
$start_date
$end_date
$posted_date
$last_updated_date
$renewed_date
$twitter_button
$facebook_button
$flag_link
$views
$adsense
$extra_fields
$ad_title
$ad_categoryurl
$ad_categoryname
$adcontactphone
$adcontact_name
$codecontact
$addetails
$awpcpvisitwebsite
$city
$state
$village
$country
$location
$aditemprice
$featureimg
$awpcpshowadotherimages
$ad_startdate
$ad_postdate
$showadsense3
$showadsense2
$showadsense1
$flagad
$awpcpadviews
$awpcpextrafields
Codes for the display ad listings page layout
$addetailssummary
$ad_title
$awpcpadpostdate
$awpcp_display_adviews
$city
$state
$awpcp_city_display
$awpcp_state_display
$awpcp_country_display
$awpcp_display_price
$ad_categoryname
$url_showad
$imgblockwidth
$awpcp_image_name_srccode
BuddyPress Field Codes
Only used with the BuddyPress Classifieds module.
$bp_user_profile_url
Returns the URL to the BuddyPress profile for the owner of the listing being displayed.
$bp_user_listings_url
Returns the URL to the list of listings of the owner of the listing being displayed.
$bp_username
Returns the username, as displayed in BuddyPress screens, of the owner of the listing being displayed.
Extra Fields Module Field Codes
When you install the Extra Fields Module, it inserts the $awpcpextrafields placeholder that will automatically add any extra fields you have created to your listings. Here is what that looks like in the Single Ad Page Display settings:
If you don't like the default placement of the fields, you have two options to rearrange them:
- Go to Classified Ads > Form Fields and drag the fields to rearrange them
- Use individual field codes for your extra field.
Removing the $awpcpextrafields will remove the default location of the fields, and then you can use individual field codes to place the fields where you'd like them to appear in the ad.
Extra Fields offers three new placeholders for each registered extra field:
$x_field_name_label
Returns the label of the field. It follows the setting that controls whether HTML is shown or not.
$x_field_name_value
Returns the value of that field for the listing being shown. If the value uses a URL, Email, Money or Date validator, the returned value will be formatted accordingly: A link for URL and Email fields and formatted strings according to plugin settings for Money and Date fields.
$x_field_name_raw
Returns the raw value of that field for the listing being shown. In this case the plugin returns the values as they were entered by the owner of the listing; no format is applied.
The field_name is the value of the first column of the Extra Fields table in the admin dashboard.
Here are some use cases:
To display your Extra Field Name only, just use $x_examplefield1_label.
If you want to show the value only, then use $x_examplefield1_value.
If you want to show both, with the label being bold, use this code:
<strong>$x_examplefield1_label: <br></strong>
$x_examplefield1_value<br>
Example extra field screenshots:
Example code to add in the single ad page layout box under Classified Ads > Settings > Display > Layout and Presentation in the Single Ad Page Display Field (the <strong> tags are HTML tags that make the label bold -- delete that code if you don't want that):
To display your Extra Field Name only, just use $x_examplefield1_label.
If you want to show the value only, then use $x_examplefield1_value.
If you want to show both, have a look at the new info I gave at the bottom of the Knowledge Base article here: https://awpcp.com/knowledge-base/placeholders-field-codes/ Here's the code I used for it:
<strong>$x_examplefield1_label: <br></strong>
$x_examplefield1_value<br>
Example display on the front end of the ad: