Show Ad

The “Show Ad” page displays individual ads when the ad title is clicked. The shortcode used in this page is [AWPCPSHOWAD] If this shortcode is missing or otherwise contains an error the page will not work. You can name this page anything you want. To avoid potential problems please edit the page names from within your Classifieds admin page, not from wordpress.

To change the page name you would go to your classifieds admin options page under the tab “Classified Pages Setup” and refer to the option:

Name for show ads page. [CAUTION: existing page will be overwritten]

The show ad page is created as a child page to the main classifieds entry page and relies not only on the shortcode, but on data passed to it through the ad title in order to display the correct individual ad.  How the data is passed to the function that the show ad page executes depends on your permalink setup and having the following classifieds admin options “SEO Settings” checked or unchecked:

Search Engine Friendly URLs? [ Does not work in some instances ]

If the option above is not checked the data is passed to the function through a query string and executed. If the above is checked but your WordPress permalinks are set to default the data is still passed through a query string. If the above is checked and your WordPress permalinks are not set to default, then the value is retrieved from the search engine optimized URL. An example of such a URL: http://www.awpcp.com/classifieds/show-ad/36/4-Dolce–Gabanna-dresses-for-sale/Reno/Nevada/USA/Clothing__Accessories/

To retrieve the needed data from the search engine optimized URL, the system has to guess where the data is located in the URL after it reads and breaks apart the URL. Not all sites will have the data stored in the same location. By default the system will look for the ad ID in the third position following the main part of the domain. (see example table below)

showadpath

In the case of the above example, the show ad page will not work straight out of the box because it will attempt to pass the value of 4-Dolce–Gabanna-dresses-for-sale as the ad ID. The ad ID is actually located in position 2 in the URL above, so it will be necessary to change the setting stored in the classifieds admin options “SEO Settings” for the show ad page in order to get the show ad page to work correctly. To do this you would need to look for

If show ad links not working in seo mode change value until correct path is found. Start at 1

and in this particular example you would need to change the value from 3 to 2. In your case the value could be 1, 4 or another number so you will need to determine where the ad ID is stored in your search engine optimized URL and enter that value to get the show ad page to work. If the actual ad ID is not passed to the function the ad will not display.

Creating your own layout

Starting with version 1.0.6.2 refer to How to modify the layout of the show ad page for instructions on how to modify the layout of the show ad page. If you are still using aversion earlier than 1.0.6.2 you may proceed with the instructions below.

To make it easier for you to avoid having to constantly reapply changes every time there’s a new update to the plugin, a file has been included for you to use if you are going to modify the layout of the show ad page. This file is named awpcp_showad_my_layout.php. Please only use this file if you are know how to edit PHP. If you do know how to edit PHP then it should not be difficult to figure out how to use the file. Refer to the function showad($adid,$omitmenu) in awpcp.php. Find the code

if( file_exists("$awpcp_plugin_path/awpcp_showad_my_layout.php") && get_awpcp_option('activatemylayoutshowad') )
{
include("$awpcp_plugin_path/awpcp_showad_my_layout.php");
}
else
{

}
The “…” represents the code in the file that handles the ad display. Transfer that code to awpcp_showad_my_layout.php and modify as needed.

Once you have completed your modifications to the layout, you need to activate the file awpcp_showad_my_layout.php To activate the file go to your classifieds admin options page under “General Settings” and check the option next to:

Activate show ad mod file [applies only if you created your own layout for the showad function in the file awpcp_showad_my_layout.php]

Provided you have no errors in your code, the system should now use your layout instead of the default.