Forums Forums Search Search Results for 'get_field'

Viewing 10 results - 71 through 80 (of 188 total)
  • Author
    Search Results

  • Anonymous
    Inactive

    Hi there,

    I’d like to use the infinite scroll mechanism in combination with masonry and the shortcode function.

    The results url points definitely pointed to the write page. And the following settings should be correct either.

    Post / Result Selector: article
    Infinite Scroll Container: .archive-query__inner

    And this is my custom results template.

    <?php if ( $query->have_posts() ): ?>
    		<div class="masonry archive-query__inner entry-content">
    			<?php while ($query->have_posts()) : $query->the_post(); $kategorie_term = get_field( 'kategorie' ); ?>
    			<article class="object <?php if ( $kategorie_term && $kategorie_term->name !== 'Fact' ) { echo 'object--blue tagged'; } elseif ( $kategorie_term->name == 'Fact' ) { echo 'object--yellow tagged'; } else { echo 'object--blue'; } ?>" id="post-<?php the_ID(); ?>">
    				<a href="<?php the_permalink(); ?>">
    					<div class="lazyload object__inner" data-bg="<?php if ( $kategorie_term->name == 'Fact' ) { echo the_field( 'factbild' ); } else { echo get_the_post_thumbnail_url(); } ?>" id="post-<?php the_ID(); ?>">
    						<?php if ( $kategorie_term ): ?>
    						<div class="overline">
    							<h6><?php echo $kategorie_term ->name; ?></h6>
    						</div>
    						<?php endif; ?>
    
    						<div class="object__inner__text content-no-margin">
    							<?php if ( $kategorie_term && $kategorie_term->name !== 'Fact' ) { echo '<h3>' . get_the_title() . '</h3>'; } elseif ( $kategorie_term->name == 'Fact' ) { echo '<h3>' . get_field( 'facttext' ) . '</h3>'; } else { echo '<h4>' . get_the_title() . '</h4>'; } ?>
    							<p class="textlink" href="<?php the_permalink(); ?>">Mehr erfahren</p>
    						</div>
    					</div>
    				</a>
    			</article>
    			<?php endwhile; ?>
    		</div>
    		<?php else: ?>
    		<div class="search-filter-results-list" data-search-filter-action="infinite-scroll-end">
    			<span>Keine Einträge gefunden...</span>
    		</div>
    		<?php endif; ?>

    Thank you in advance for your help!


    Anonymous
    Inactive

    Hi Trevor,

    My first post maybe wasn’t that clear. I apologize. We’re using a custom WP query for this page to show all the activities (activiteiten). When clicking the ‘bekijk activiteit’ button on the activiteiten page it show an error in console from Google Chrome devtools (error in first post) and we can’t figure out what’s causing it.

    The button is working (forwarding to the detail page) when we turn off the ajax setting in the S&F settings.

    This is our custom post type:

    <?php
    
    $atts = shortcode_atts(
    	[
    		'number'    => -1,
    		'orderby'   => 'menu_order',
    		'category' => '',
    	],
    	$atts,
    	'alle_activiteiten'
    );
    
    $numberposts = $atts['number'];
    $order_by    = $atts['orderby'];
    $category    = $atts['category'];
    
    // args.
    $args = array(
    	'post_type'      => 'activiteit', // CPT slug.
    	'posts_per_page' => $numberposts,
    	'post_status'    => 'publish',
    	'orderby'        => $order_by,
        'order'          => 'ASC',
    	'search_filter_id' => 125,
    	'show' => 'results',
    	/*'tax_query'      => array(
    		array(
    			'taxonomy' => 'my_category_slug',
    			'field'    => 'slug',
    			'terms'    => $category,
    			'operator' => 'AND',
    		),
    	),*/
    );
    
    $activiteiten = new WP_Query( $args );
    
    if ( $activiteiten->have_posts() ) :
    	while ( $activiteiten->have_posts() ) :
    		$activiteiten->the_post(); ?>
    	<div class="alleKamersBlok bmargin">
    		<div class="alleKamersImage">
    			<?php the_post_thumbnail('medium-large'); ?>
    		</div>
    		<div class="alleKamersText activiteitenText">
    			<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    			<h4 class="cat"><?php echo get_field("activiteiten_soort_activiteit"); ?></h4>
    			<p><?php echo get_the_content(); ?></p>
                <div class="buttonContainer"><a itemprop="url" href="<?php the_permalink(); ?>" target="_self" class="qbutton  default" style="">Bekijk activiteit</a></div>
    			
    		</div>
    	</div>
    	
    
    		<?php
    	endwhile;
    	wp_reset_postdata();
    
    else :
    	_e( 'Woops! Niks gevonden.', 'flux' );
    endif;
    ?>

    Hope this clears things up.

    #201589

    Trevor
    Participant

    Maybe my code and suggestion was almost corect, but it needs the post ID, like this:

    <?php $textobt = get_field('texto_boton', get_the_ID() ); ?>

    #200172

    Anonymous
    Inactive

    The data is blank after the search, you are right. Thank-you for your help so far, what do you suggest?

    Array
    (
    [post_type] =>
    [search_filter_id] =>
    )

    ;

    
          <?php
          $postType = get_field('post_type', get_the_ID());
          $searchId = get_field('search_id', get_the_ID());
    
          echo do_shortcode('[searchandfilter id="'.$searchId.'"]'); 
          ?>
    
          <div class="buy-wrapper" id="search-results">
          <?php
          $args = array('post_type' => $postType);
          $args['search_filter_id'] = $searchId;
          ?>
          <pre><?php print_r($args);?></pre>;
    
          <?php
          
          $category_posts = new WP_Query($args);
    
          if($category_posts->have_posts()) : 
            while($category_posts->have_posts()) : 
               $category_posts->the_post();
          ?>
    #200161

    Anonymous
    Inactive

    I have made the code a little cleaner, I tried get_the_ID() and this did not work, I also have taken the variables out of the AJAX container (#search-results) and still get the same issue.

    The form in the first line does work fine, it is literally just the results that go to all uncategorised. Echoing those 2 args, produces the correct array and ID.

    
          <?php
          $postType = get_field('post_type', get_the_ID());
          $searchId = get_field('search_id', get_the_ID());
    
          echo do_shortcode('[searchandfilter id="'.$searchId.'"]'); 
    
          $args = array('post_type' => $postType);
          $args['search_filter_id'] = $searchId;
    
          print_r($args = array('post_type' => $postType));
          echo $args['search_filter_id'] = $searchId;
          ?>
    
          <div class="buy-wrapper" id="search-results">
          <?php
          $category_posts = new WP_Query($args);
    
          if($category_posts->have_posts()) : 
            while($category_posts->have_posts()) : 
               $category_posts->the_post();
          ?>
    #200155

    Trevor
    Participant

    Is it just these two lines that do not work?

    $args = array('post_type' => get_field('post_type'));
    $args['search_filter_id'] = get_field('search_id');

    If you use an echo with a message to prefix those lines, do the post type and id output or are they empty?

    Does the form in the first line of the code output OK?

    What happens if you add the Post ID as the second argument. E.g.

    $args = array('post_type' => get_field('post_type', get_the_ID()));
    $args['search_filter_id'] = get_field('search_id', get_the_ID());
    #199084

    Trevor
    Participant

    Try moving this line:

    <?php $textobt = get_field('texto_boton'); ?>
    

    To immediately after this line:

    $query->the_post();
    
    #199075

    Anonymous
    Inactive

    Hi there. I´m getting well a variable ($textobt) in results.php loop, but when I apply a filter or I when I get more results when scroll the page, I can’t ge the variable.

    This is my code

    	<div class="search-filter-results-list">
    		<div class="row">
    			<?php $textobt = get_field('texto_boton'); ?>
    			<?php  
    				while ($query->have_posts())
    				{
    					$query->the_post();
    					
    					?>
    
    					<article class="search-filter-result-item col-xs-6 col-sm-3 col-lg-2 item-n">
    				        <div class="item-espectaculo">
    				          <?php the_post_thumbnail('thumbnail', array('class' => 'item-img'), [ 'alt' => esc_html ( get_the_title() ) ]);?>
    				          <div class="item-container">
    				            <div class="ciudad"><img />/images/icon-position.png" height="13" class="icon-pos"><?php the_field('ciudad'); ?></div>
    				            <h1><?php the_title(); ?></h1>
    				            <div class="item-fechas"><?php the_field('desde'); ?> - <?php the_field('hasta'); ?></div>
    				            <div class="sep-info"></div>
    				            <!-- <div class="item-preciodesde">Desde <span class="carga-precio">0</span>€</div> -->
    				            <button type="submit" onclick="window.location.href = '<?php the_field('url_espectaculo'); ?>';" class="btn btn-primary btn-lg btn-block bt-item"><?php echo $textobt; ?></button>
    				          </div>
    				        </div>
    				    </article>
    					
    					<?php
    				}
    			?>
    		</div>
    	</div>

    And this is my site: https://eventos.entradas.com/

    Thanks.

    #198936

    Anonymous
    Inactive

    Hi,

    We have set-up a custom query with an ACF relationship field.

    This works without S&FP.

    When we add 'search_filter_id' => 4356, to the WP Query, suddenly all posts are shown and not only the ones we defined in our WP_Query. (when we comment it out, it works)

    Below the full code

    	
            // Get account linked to logged in user
    	$account = get_field( 'field_5c3a01aa0a32e', 'user_' . get_current_user_id() );
    	
    	// Get lassers from that account: returns array of ID's
    	$lassers = get_field( 'field_5c3a0bb483f86', $account[0]->ID );
    
    	// args Query
    	$args = array(
    		'post_type'      => 'lasser',
    		'posts_per_page' => -1,
    		'post_status'    => 'publish',
    		'order'          => 'ASC',
    		'search_filter_id' => 4356,
    		'post__in'       => $lassers,
    
    	);

    We also tried the filter sf_edit_query_args but that doesn’t work either.

    Any idea why the above isn’t working/


    Anonymous
    Inactive

    I’ve got an ACF image field. Any way I can use the tags in this field as a filter?

    $image = get_field('72dpi_image');

    I tried to use the field as a Post Meta filter but it’s not showing up, nor do the tags show up only a field is there.

    null

    What I’m trying to do is use the tags of the image as a filter.

Viewing 10 results - 71 through 80 (of 188 total)