-
Search Results
-
Hello,
I have a custom results.php. In this I load a shortcode:
if (!empty(get_field('_smt-gallery-shortcode'))) { $galleryShortcode = "[foogallery id=" . get_field('_smt-gallery-shortcode') . " paging_size=3]"; echo $galleryShortcode; echo do_shortcode("$galleryShortcode"); }When th page is loaded the first time everything works fine. When I change the filter and the page is reloaded (ajax on) the shortcode is not shown.
When I diasble Ajax in the Search&Filter settings the whole page is reloaded and the shortcode is shown.
What can I do to load the shortcode together with ajax refresh.
Robert
Hello,
I use ACF and Search and Filter Pro for a “calendar like”.
I have a ACF field type : date (event-date).
I have a Search And Filter form and i use this meta key (event-date) in a dropdown element.The problem i have :
https://prnt.sc/swnklv
The display of the date in the dropdown element is différent than the get_field function. I want “10/06/2020” not “20200610”. Where can i change this setting ? I check the ACF config, but the display is correct : https://prnt.sc/swnm3tCan you help me please ?
I have couple of issues
See this page
https://acu2020dev.wpengine.com/story
I have created a page template and added the shortcodesecho do_shortcode('[searchandfilter id="133"]'); echo do_shortcode('[searchandfilter id="133" show="results"]');I am showing a featured post first and then I am showing the listing
As I dont want to show the featured post I added the following codefunction filter_function_name( $query_args, $sfid ) { //echo "Coming here"; //if search form ID = 225, the do something with this query if($sfid==133) { //modify $query_args here before returning it if (is_page_template('page-templates/stories.php')) { //echo "This is ".get_queried_object_id(); $featured_story = get_field("featured_story_landingpage",get_queried_object_id()); $exclude = array($featured_story->ID); $query_args['post__not_in'] = $exclude; } } return $query_args; } add_filter( 'sf_edit_query_args', 'filter_function_name', 20, 2 );This works alright when the page is loaded, but when I click the Clear filter button or when a category is selected, the above exclusion is ignored and the featured post is shown in the listing
What am I doing wrong? or is this a bug in the plugin?
Also how can I show a numbered pagination?
regardsOn NovaScotiaFood.com I have a search form that uses AND as an operator. The user simply selects a category of food producer and a county, and they get a list of that type of food producer in the selected county. The search works fine. The results are not yet displaying the way I’d like.
I’ve just copied some of your example code on my results page:
<?php //Get a multiple fields values by passing an array of field names //replace <code>1526</code> with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(1949)->current_query(); /* * EXAMPLE 1 */ echo $sf_current_query->get_fields_html( array("_sft_category", "_sft_meta_value") );where I just tried to guess that ‘_sft_meta_value’ would output the custom field entry that was searched for, but I guessed wrong. What should I be putting in there instead to correctly output the custom field? Thanks.
Pagination doesn’t” work properly
Hello. I am using search and Filter pro and having problem with pagination.
It seems to work fine but when I go back to page 1, only page 1 doesn’t have the link(doesn’t have href).
And it happens only PC view, if I check with SP, it works just fine.Here is My code.
(*I use original code for pagination, but if tried to use WP-PageNavi(same as your template of results.php) Page 1 doesn’t work either.)[results.php]
<?php if ($query->have_posts()) : ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <a href="<?php the_permalink(); ?>" class="sresult"> <?php if (has_post_thumbnail()) { echo '<p class="sresult-thumb">'; the_post_thumbnail(); echo '</p>'; } ?> <h2 class="sresult-ttl"><?php the_title(); ?></h2> <p class="sresult-name"><?php the_field('interview_name'); ?> </p> <?php $fields = get_field_objects($post_id); $dir_array = $fields["interview_occupation"]["choices"]; $check = get_field('interview_occupation'); $value = $check[0]; ?> <p class="sresult-job"><?php echo $dir_array[$value]; ?></p> </a><!-- /.sresult --> <?php } ?> <div class="spagination"> <?php if ( function_exists( 'pagination' ) ) : pagination( $query->max_num_pages, get_query_var( 'paged' ) ); endif; ?> </div><!-- /.spagination --> <?php else : ?> <div class="snoresult"> <p>No results</p> </div><!-- /.snoresult --> <?php endif; ?> </div><!-- /. search-filter-results -->[functions.php]
function pagination( $pages, $paged, $range = 2, $show_only = false ) { $pages = ( int ) $pages; $paged = $paged ?: 1; //表示テキスト $text_first = "« FIRST"; $text_before = "PREV"; $text_next = "NEXT"; $text_last = "LAST »"; if ( $show_only && $pages === 1 ) { echo '<div class="pagination"><span class="current pager">1</span></div>'; return; } if ( $pages === 1 ) return; if ( 1 !== $pages ) { echo '<div class="pagination"><span class="page_num">Page ', $paged ,' of ', $pages ,'</span>'; if ( $paged > $range + 1 ) { // FIRST echo '<a href="', get_pagenum_link(1) ,'" class="first js_redirect_to_pagenum_link">', $text_first ,'</a>'; } if ( $paged > 1 ) { // PREV echo '<a href="', get_pagenum_link( $paged - 1 ) ,'" class="prev js_redirect_to_pagenum_link">', $text_before ,'</a>'; } for ( $i = 1; $i <= $pages; $i++ ) { if ( $i <= $paged + $range && $i >= $paged - $range ) { // $paged +- $range 以内であればページ番号を出力 if ( $paged === $i ) { echo '<span class="current pager">', $i ,'</span>'; } else { echo '<a href="', get_pagenum_link( $i ) ,'" class="pager js_redirect_to_pagenum_link">', $i ,'</a>'; } } } if ( $paged < $pages ) { // NEXT echo '<a href="', get_pagenum_link( $paged + 1 ) ,'" class="next js_redirect_to_pagenum_link">', $text_next ,'</a>'; } if ( $paged + $range < $pages ) { // LAST echo '<a href="', get_pagenum_link( $pages ) ,'" class="last js_redirect_to_pagenum_link">', $text_last ,'</a>'; } echo '</div>'; } }The website is my client site so I cannot give you the link. But if you provide me a contact address that I can send you directly or hide this topic somehow, I can give you the link of testsite.
Regards,