Forums Forums Search Search Results for 'get_field'

Viewing 10 results - 41 through 50 (of 188 total)
  • Author
    Search Results
  • #227478

    Anonymous
    Inactive

    i create search form, i use shortcode, i create page with my shortcode but the results not good,
    i use like this:

    function select_artist_in_filter_page() {
    	$args = array('post_type' => 'artist','posts_per_page' => -1);
        $my_query = new WP_query($args);
       if($my_query->have_posts()) {
    		echo '<div class="elementor-container elementor-column-gap-default">
    		<div class="elementor-row">
    				<div class="elementor-element elementor-element-80b276a elementor-column elementor-col-100 elementor-top-column" data-element_type="column">
    			<div class="elementor-column-wrap  elementor-element-populated">
    					<div class="elementor-widget-wrap">
    				<div class="elementor-element elementor-element-62b3681 elementor-grid-4 elementor-grid-tablet-4 elementor-grid-mobile-1 elementor-posts--thumbnail-top elementor-card-shadow-yes elementor-posts__hover-gradient elementor-widget elementor-widget-archive-posts" data-element_type="widget" data-widget_type="archive-posts.archive_cards">
    				<div class="elementor-widget-container">
    					<div class="elementor-posts-container elementor-posts elementor-grid elementor-posts--skin-cards elementor-has-item-ratio">';
            while($my_query->have_posts()) { 
    			$my_query->the_post();
                $custom = get_post_custom(get_the_ID());
    			$image = wp_get_attachment_image_src( get_post_thumbnail_id( $args->ID ), 'single-post-thumbnail' ); // the images for the artist	
    			echo '<article class="elementor-post elementor-grid-item post-170 artist type-artist status-publish has-post-thumbnail">
    			<div class="elementor-post__card">
    			<a class="elementor-post__thumbnail__link" href="'.get_permalink($args->ID).'">
    			<div class="elementor-post__thumbnail"><img height="150" src="'.$image[0].'" alt=""></div>
    		</a>
    				<div class="elementor-post__text">
    				<h3 class="elementor-post__title">
    			<a href="'.get_permalink($args->ID).'">'.get_field('artist_name').'</a>
    		</h3>
    				</div>
    				<div class="elementor-post_meta-data" style="text-align: center; background: #d80159;">
    				<a class="elementor-post__read-more" href="tel:'.get_field('Artist_Phone').'">'.get_field('Artist_Phone', $args->ID).'</a>
    				</div>
    				<div class="elementor-post__meta-data">
    					<span class="elementor-post-avatar">
    		המלצות: '.get_comments_number($my_query->ID).'	</span>
    				</div>
    					</div>
    						</article>';
    	   }
    		echo '</div></div></div></div></div></div></div></div>';
    	   wp_reset_postdata();
       }
    }
    
    function select_artist_in_filter_page_reset() { // reset the loop
    	ob_start();
    		select_artist_in_filter_page();
    	return ob_get_clean();
    }

    but i not see the real options, i see all artist i need to see the artist with location i choose in fitlers:
    https://mesibot.linuxisrael.co.il/filterresults/?_sft_location_artist=%d7%9b%d7%9c-%d7%94%d7%90%d7%a8%d7%a5
    this is the url

    way is not working ?

    #226945

    In reply to: Infinite Scroll


    Anonymous
    Inactive

    Hi Trevor,

    Apologies I’ve only just gotten around to trying this out, at the minute I get both messages coming up and I’m not entirely sure why, this is my results.php file.

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link https://searchandfilter.com
    * @copyright 2018 Search & Filter
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */

    if ( $query->have_posts() )
    {
    ?>
    <div class=”flex-grid” data-aos=”fade-up”>
    <?php
    while ($query->have_posts()){
    $query->the_post();
    ?>
    <div class=”RoleGridWrapper col”>
    <?php if( get_field(‘scrub_colour’) == ‘navy-blue’){ $postcolor = ‘#153F74’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘cornflower-blue’){ $postcolor = ‘#5184C4’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘mediterranean-blue’){ $postcolor = ‘#009EC7’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘ocean-blue’){ $postcolor = ‘#64BFD4’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘pale-sky-blue’){ $postcolor = ‘#97BADE’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘dark-green’){ $postcolor = ‘#00A296’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘mid-green’){ $postcolor = ‘#92CEBD’; } ?>
    <?php if( get_field(‘scrub_colour’) == ‘silver-grey’){ $postcolor = ‘#ABAAAB’; } ?>
    <div class=”roleContWrapper” style=”border-top: solid 10px <?php echo $postcolor; ?>”>
    <div class=”cardTAB”>
    <svg id=”scrubsIcon” data-name=”Layer 1″ xmlns=”http://www.w3.org/2000/svg&#8221; viewBox=”0 0 40 40″><title>Scrubs Icon</title><path style=”fill:<?php echo $postcolor; ?>;” d=”M39.6,7.22a40.13,40.13,0,0,0-13-4.12,1.11,1.11,0,0,0-1.39.72c-.43.91-.88,1.73-.92,1.8-1.72,3.28-3.54,6-4.18,6.19-.66-.16-2.48-2.63-4.25-5.63-.46-.76-.8-1.42-1.25-2.28a1.29,1.29,0,0,0-1.52-.77A37.94,37.94,0,0,0,.4,7.22a.78.78,0,0,0-.32,1L3.47,15a.79.79,0,0,0,.9.41l3.49-.87L6.78,36.11a.79.79,0,0,0,.79.83H32.43a.79.79,0,0,0,.79-.83L32.14,14.57l3.49.87a.79.79,0,0,0,.9-.41l3.39-6.78A.78.78,0,0,0,39.6,7.22Z”/></svg>
    </div>
    “>
    <h3 class=”postHeader”><?php the_title(); ?></h3>
    <div class=”postCATS”>
    <?php
    $categories = get_the_category();
    $parentCatName = get_cat_name($categories[0]->parent);
    if ( ! empty( $categories ) ) {
    ?>
    <span class=”parentCAT”><?php echo esc_html( $parentCatName ); ?></span>
    <?php
    }
    ?>
    </div>
    <p class=”postIntro”><?php the_field(‘brief_role_description’); ?></p>
    <div class=”readmoreWrapper”>
    <p class=”postreadmore” href=”<?php the_permalink(); ?>”>Learn more</p>
    </div>

    </div>
    </div>
    <?php
    }
    }else{
    //figure out which type of “no results” message to show
    $message = “noresults”;
    if(isset($query->query[‘paged’])) {
    if($query->query[‘paged’]>1){
    $message = “endofresults”;
    }
    }
    if($message==”noresults”) {
    ?>
    <div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
    <span>No Results Found</span>
    </div>
    <?php
    } else {
    ?>
    <div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
    <span>End of Results</span>
    </div>
    <?php
    }
    }
    ?>

    Can’t seem to see why it’s not choosing one or the other, the only way at the moment I can get it to find no results is to search for something that I know isn’t available.

    Thank you
    Scott

    #224682

    Anonymous
    Inactive
    
    $args = array('post_type' => 'post');
    $args['search_filter_id'] = 123;
    $query = new WP_Query($args);
    

    and

    
    <?php if ( $query->have_posts() ) : ?>
      <!– the loop –>
      <?php while ( $query->have_posts() ) : $query->the_post(); ?>
        <!– get post tags field –>
        <?php $checkbox_fields = get_field("checkbox_field_name"); ?>
    

    did my code markup wrong there whoops

    #224680

    Anonymous
    Inactive

    I got it working by using the following code from this page: https://searchandfilter.com/documentation/search-results/custom/

    `
    $args = array(‘post_type’ => ‘post’);
    $args[‘search_filter_id’] = 123;
    $query = new WP_Query($args);
    `

    and then using “the loop” and grabbing the checkbox field for each post:

    `
    <?php if ( $query->have_posts() ) : ?>
    <!– the loop –>
    <?php while ( $query->have_posts() ) : $query->the_post(); ?>
    <!– get post tags field –>
    <?php $checkbox_fields = get_field(“checkbox_field_name”); ?>
    `

    Then running a foreach on $checkbox_fields to display them or a certain amount of them for each result.

    Posting this here so people can use this in the future if they want to better control how their results are displayed.

    #223908

    Anonymous
    Inactive

    Sorry, Now is working but I have to reload the home page to see the results, if I don’t reload page the results are all posts.

    Any idea?

    My code:

    <?php echo do_shortcode ('[searchandfilter id="2611"]'); ?>
    		
    		<?php $args = array('post_type' => 'coche');
    		$args['search_filter_id'] = 2611;
    		$query = new WP_Query($args);?>
    
    		<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); // run the loop ?>
    			<div <?php post_class('col-sm-4 col-md-4'); ?>>
    			    <a class="thumb_rel" href="<?php echo get_permalink();?>"><?php echo get_the_post_thumbnail();?></a>
    			    <span class="posted-on">
    		            <span class="screen-reader-text">Publicado el </span>
    		            <time class="entry-date published"><?php echo get_the_date()?></time>
    		            <span class="tiempo_lectura">Tiempo de lectura <?php echo get_post_meta(get_the_ID(), 'tiempo_de_lectura', true)?>´</span>
    			    </span>
    			    <h4><a class="title_rel" href="<?php echo get_permalink();?>">
    				    <?php if( get_field('titulo_listado_3_noticias') ) { ?>
    				    	<?php the_field ('titulo_listado_3_noticias')?>
    					<?php } else { ?>
    					  <?php the_title (); ?>
    					<?php }?>
    				    </a>
    				</h4>
    			    <hr class="linea-post">
    			    <p><?php echo get_the_excerpt()?></p>
    			</div>
    		<?php endwhile; ?>
    		<?php endif; ?>
    		<?php wp_reset_query(); ?>
    #222988

    Anonymous
    Inactive

    I want to do some custom formatting depending on the used filters… I tried this:
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(69991)->current_query();
    echo $sf_current_query->get_fields_html(
    array(“_sfm_mk_quelle_affiliate_shop”),
    $args
    );

    … and: echo $sf_current_query->get_field_string(“_sfm_mk_quelle_affiliate_shop”);

    And took the field name from my search url:
    https://miriamkreativ.de/material?_sfm_mk_quelle_affiliate_shop=Creativ-Discount

    But there is nothing shown unfortunately…

    I tried one more thing (displaying the searchg term):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(69991)->current_query();
    echo $sf_current_query->get_search_term();

    … and this works for me. So please can you help me with the first example, showing / getting the chosen “affiliate shop”-option?

    #220782

    Trevor
    Participant

    Ah, OK.

    I think you should use our Shortcode method instead. See here and also follow the guide for customising:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/

    Then, either edit the results.php file yourself, or contact me and I will edit the results.php file for you. I think the content needs to be like this:

    if ( $query->have_posts() )
    {
    	?>
    	
    	<div class="ngo-list">	
    		<div class="table">
    				
                <table>
                    <tr>
    					<th>Name</th>
    					<th>Category </th>
    					<th>Website </th>
    					<th>Learn More </th>
    				</tr>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
                    <tr>
    					<td><h5 class=""><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5></td>
    					<td><?php $term = get_field('ngo_category'); echo get_term($term)->name; ?></td>
    					<td><a href="<?php the_field('website'); ?>"><?php the_field('website'); ?></a></td>
    					<td><a href="<?php the_permalink(); ?>">View Details</a></td>
    				</tr>
    		<?php
    	}
    	echo paginate_links();
    	
    } ?>
                </table>
    					
            </div>
    	</div>	
    
    ?>
    #220392

    Trevor
    Participant

    So, if I understand you correctly, you want to conditionally show this part:

    <div class="desc"><img src="<?php the_field('image'); ?>”><p><?php the_field('business_description') ?></p></div>

    so, it would be this:

    <?php if (get_field('image')) {?>
    <div class="desc"><img src="<?php the_field('image'); ?>”><p><?php the_field('business_description') ?></p></div>
    <?php }?>

    This uses get_field to see if the image field has anything in it, and only outputs that bit if it does. I am assuming here that if the image exists, so will the description.

    I hope that helps?

    #220260

    Anonymous
    Inactive

    Yes,

    I’m trying to figure it out. But all what I try it also removes the term.

    Like, if it is “activity: ski jobs” it ends with “jobs”

    Using this code:

    <?php echo $sf_current_query->get_field_string(“_sft_activities”); ?> jobs

    Thank you in advance!

    #220252

    Anonymous
    Inactive

    Ok got it:

    <?php echo $sf_current_query->get_field_string(“_sft_activities”); ?> jobs

    But it displays like this activities: ski jobs

    How can I remove the “activities:”

    Thanks again for your time!

Viewing 10 results - 41 through 50 (of 188 total)