I am using wordpress to output some ads on a non wordpress page. The HTML on the non wordpress test server page is:
<?php
require('/home/mcreativ/public_html/parts/imagerotator/wp-load.php');
echo init_ads();
?>
On my Test server I have this code in the functions file and the post type is a custom post type I have created call manufacturer:
function init_Ads() {
echo $_SERVER['DOCUMENT_ROOT'];
$serial = $_GET["serial"];
// args for query
$args = array(
'numberposts' => -1,
'post_type' => 'manufacturer',
'meta_key' => 'smashing_post_class',
'meta_value' => $serial
);
$the_query = new WP_Query( $args );
$the_query->the_post();
$meta= get_post_meta( get_the_ID(), 'ad_rotator_group', TRUE);
wp_reset_query(); // Restore global post data stomped by the_post().
echo adrotate_group($meta);
}
And on the test URL http://www.m1creative.org/noword/index.php?serial=57 it works.
I am passing in a number ‘serial’ and extracting its corresponding ad group which then displays the correct ads on the page. Use serial = 57 to get a valid ad group.
On the live server page: https://www.partslocator.com.au/adsrotator/testnoword.php?serial=57 it doesn’t work.
This is the HTML of the live server non wordpress page:
<?php
require('/var/www/plm/data/www/partslocator.vm-host.net/adsrotator/wp-load.php');
echo init_ads();
?>
If I change the echo adrotate_group($meta); to echo adrotate_group(1); I get the correct result and the ads display.
I am not using the loop in the query as there is only ever going to be one result.
Is the https causing me problems or is there something else I haven’t spotted?