Подключайте другим способом. А вообще, если хотите чтобы вам ответили, распишите более подробно что куда как и желательно с выложенным кодом.
Мне нужен фильтр по категориям без обновления страницы, с моим темплейтом
код с кнопкой вызова темплейта:
<div id="myForm">Plane</div>
<div id="content"></div>
<script>
$(document).ready(function(){
$('#myForm').click(function(){
$.ajax({
type: "POST",
url: "jstest.html",
success: function(html){
$("#content").html(html);
}
});
return false;
});
});
код с выводом темплейта:
$title = apply_filters('widget_title', empty($instance['title']) ? __('Popular Posts') : $instance['title'], $instance, $this->id_base);
echo $before_widget;
echo $before_title . $title . $after_title;
$count = ( !empty( $count ) ) ? trim( $count ) : '3';
$disable_thumb = $instance['disable_thumb'] ? '1' : '0';
$paged = mysite_get_page_query();
$popular_query = new WP_Query(array(
'showposts' => '10',
'post_type' => 'page',
'nopaging' => 0,
'category__in' =>26,
'orderby'=> 'title',
'order' => 'ASC',
'paged' => $paged,
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
));
echo filters_generate();
$out = the_category($separator, $parents, 28);
$out .= '<table>';
$out .= '<tr>';
$out .= '<td> </td>';
$out .= '<td> Название</td>';
$out .= '<td> Дата выхода</td>';
$out .= '<td> Рейтинг</td>';
$out .= '</tr>';
$out .= '<tr>';
while ( $popular_query->have_posts() ) {
$popular_query->the_post();
$out .= '<td>';
foreach ($popular_query as $post)
$image= get_post_thumbnail_id($post->ID);
if (preg_match_all( '!ngg-.+!', $image, $matches )){
foreach ($matches[0] as $image)
$image = substr($image, 4);
$out .= '<a href="'. esc_url(get_permalink()).'">'. nggWidgetPicture($image, 140 , 195 ) . '</a>';
}
else { $widget_thumb_img = $mysite->layout['big_sidebar_images']['small_post_list'];
$out .= mysite_get_post_image(array(
'height' => '195',
'width' => '140',
'img_class' => 'post_list_image',
'preload' => false,
'placeholder' => true,
'echo' => false,
'wp_resize' => ( mysite_get_setting( 'image_resize_type' ) == 'wordpress' ? true : false )
));}
$release_date = get_custom_field('relizdate');
$release_date = maxsite_the_russian_time($release_date);
$rating = wp_gdsr_rating_article($post->ID);
$out .= ' </td>';
$out .= '<td style="vertical-align:top; width:65%;"><a href="'. esc_url(get_permalink()).'"><h5>'. get_the_title() .'</h5></a><div>'. get_the_excerpt() .'</div><div>';
$out .= '<ul class="w_all_game">';
$children = wp_list_pages("sort_column=menu_order&exclude=$page_exclusions&title_li=&child_of=" . $post->ID . "&echo=0&depth=1");
$out .= $children;
$out .= '</ul>';
$out .='</div></td>';
$out .= '<td> '. $release_date . '</td>';
if ($rating->rating == 0){
$out .= '<td ><a class="rating" style="font-size: 20px;" href="'. esc_url(get_permalink()).'">Н/Р</a></td>';
}
else {
$out .= '<td ><a class="rating" style="font-size: 20px;" href="'. esc_url(get_permalink()).'">'. $rating->rating .'</a></td>';
}
$out .= '</tr>';
}
$out .= '</table>';
$out .= mysite_pagenavi( '', '', $popular_query );
echo $out;
echo $after_widget;
wp_reset_postdata();
так вот эти функции не интерпретируются при том что вызов идет из страницы wordpress
Собственно проблему решил все решается добавлением строчки в вызываемую страницу то бишь перед началом кода вставить: require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');