Answer the question
In order to leave comments, you need to log in
How to wrap in a tag?
There is a code
if( $results->have_posts() ){
$extra_class = '';
if( isset($results->post_count, $results->found_posts) && $results->found_posts > $results->post_count ){
$extra_class = 'has-view-all';
}
$html = '<ul class="'.$extra_class.'">';
while( $results->have_posts() ){
$results->the_post();
$link = get_permalink($post->ID);
$image = '';
if( $post_type == 'product' ){
$product = wc_get_product($post->ID);
$image = $product->get_image();
}
else if( has_post_thumbnail($post->ID) ){
$image = get_the_post_thumbnail($post->ID, 'thumbnail');
}
$html .= '<li>';
$html .= '<div class="thumbnail">';
$html .= '<a href="'.esc_url($link).'">'. $image .'</a>';
$html .= '</div>';
$html .= '<div class="meta">';
$html .= '<a href="'.esc_url($link).'" class="title">'. ts_search_highlight_string($post->post_title, $search_string) .'</a>';
$html .= '<div class="description">'. ts_the_excerpt_max_words($desc_limit_words, '', true, ' ...', false) .'</div>';
if( $post_type == 'product' ){
if( $price_html = $product->get_price_html() ){
$html .= '<span class="price">'. $price_html .'</span>';
}
}
$html .= '</div>';
$html .= '</li>';
}
$html .= '</ul>';
if( isset($results->post_count, $results->found_posts) && $results->found_posts > $results->post_count ){
$view_all_text = sprintf( esc_html__('View all %d results', 'gon'), $results->found_posts );
$html .= '<div class="view-all-wrapper">';
$html .= '<a href="#">'. $view_all_text .'</a>';
$html .= '</div>';
}
wp_reset_postdata();
$return = array();
$return['html'] = $html;
$return['search_string'] = $search_string;
die( json_encode($return) );
}
<a>
<li>
<div class="thumbnail">
......
</div>
</li>
</a>
Answer the question
In order to leave comments, you need to log in
You can try using $stateParams and pass data directly to url when redirecting:
$state.go("/pages", {data: yourData}); at the same time, when the controller is restarted, the data will be stored in data.
More or less like this
Use kveri parameters. Passed in url after "?" in the form key=value & otherKey=otherValue
app.post('/notes', function(req, res){
var options = body;
var _name = options.name;
var _age = options.age;
res.redirect('/page?name=_name&age=_age')
})
app.get('/page', function(req, res){
var options = req.query;
var name = options.name;
var age = options.age;
....
})
Made it like this
$html .= '<a href="'.esc_url($link).'"><li>';
$html .= '</li></a>';
<a></a>
<li>
<a></a>
</li>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question