This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Reply To: Mailpress and news scroller plugin

#584
deancs
Participant

Thankyou for the response. I have tried the enqueue script, but hadn’t used the dependency parameter for jquery. Optimistically I made the change but the result was the same. On the wineries page if you hover over a winery name on the left it highlights the winery location on the map on the right. The location on the map, along with other details are stored as a custom fields on the post for each winery. To do this I call two custom shortcodes which generate html and the JS required for the jquery-maphighlight functionality. My assumption is with enqueue script these would be loaded before any shortcodes in the body are executed, however based on the error message it seems the in page JS is being executed before the enqueue script. I would like to solve the problem as I would really prefer to work within the WP and theme conventions but its all getting complicated. This question is waaaayyy outside the realm of theme support so a ‘leave it to you’ response would be fine 🙂

In my WP page I have;

[raw]
[two_third][listWineries][/two_third]
[one_third last]
[wineryMap]
[/one_third]
[clear]
[/raw]

In my functions.php I have the following;

function listWineries_func( $atts, $content = null ) {

$wParams = shortcode_atts( array(‘category’ => ‘Wineries’),$atts );
$wCategory = $wParams[‘category’];

$outHTML = ‘

phone
web
area
Services

‘;
$outJS = ”;

$kvvURL = get_bloginfo(‘url’);
query_posts(‘category_name=’.$wCategory.’&order=ASC&orderby=title’);
while ( have_posts() ) : the_post();
$wTitle = get_the_title();
$wLink = get_permalink();
$tmp = get_post_custom_values(‘phone’,$post->ID);
$wPhone = $tmp[0];
$tmp = get_post_custom_values(‘url’,$post->ID);
$wURL = $tmp[0];
$tmp = get_post_custom_values(‘area’,$post->ID);
$wArea = $tmp[0];
$tmp = get_post_custom_values(‘mapID’,$post->ID);
$wMapID = $tmp[0];

$outHTML .= ‘‘. $wTitle . ‘‘ .$wPhone .’‘.$wURL.’‘.$wArea.”;

$outJS .=’doMap(\’#’.$wMapID.’lnk\’,\’#’.$wMapID.’1\’);’;

$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {

switch ($tag->name) {
case “accommodation”:
case “wifi”:
case “coffee”:
case “food”:
case “cellardoor”:
case “cellardoor-check”:
case “buyonline”:
$outHTML .= ‘name . ‘.png” alt=”‘ . $tag->name . ‘” title=”‘.$tag->name.'”/>’;
break;
}
}
}

$outHTML .= ”;
endwhile;
$outHTML .= ”;
$outHTML .= ”;
$outHTML .= ‘function doMap( myLink, myArea) {$(myLink).mouseover(function(e) {$(myArea).mouseover();}).mouseout(function(e) {$(myArea).mouseout();}).click(function(e) { e.preventDefault(); });}’;
$outHTML .= ‘$(function() {$(\’.mymap\’).maphilight({“stroke”:false,”fillColor”:”ff0000″,”fillOpacity”:0.7});’;
$outHTML .= $outJS;
$outHTML .= ‘});’;
wp_reset_query();

return $outHTML;
}
add_shortcode( ‘listWineries’, ‘listWineries_func’ );

function wineryMap_func () {

$kvvURL = get_bloginfo(‘url’);
$outHTML = ”;
$outHTML .= ”;

query_posts(‘category_name=Wineries&order=ASC&orderby=title’);
while ( have_posts() ) : the_post();
$wTitle = get_the_title();
$tmp = get_post_custom_values(‘mapCoords’,$post->ID);
$wMapCoord = $tmp[0];
$tmp = get_post_custom_values(‘mapID’,$post->ID);
$wMapID = $tmp[0];

$outHTML .= ”;
$outHTML .= ”;
endwhile;
$outHTML .= ”;
wp_reset_query();
return $outHTML;
}
add_shortcode( ‘wineryMap’, ‘WineryMap_func’ );

  • This reply was modified 7 years, 10 months ago by deancs.