Forums Forums Search Search Results for 'get_field('

Viewing 10 results - 51 through 60 (of 90 total)
  • Author
    Search Results
  • #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.

    #193395

    Trevor
    Participant

    It took me a little while, but this seems to do it:

    <p>Secteur : <?php $cial_secteur = get_field('cial_secteur');
    $cial_secteur_rec = $cial_secteur[0];
    echo $cial_secteur_rec -> post_title;?></p>
    #193240

    Anonymous
    Inactive

    At this time my code is :

    <div class="commercial">
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			<p>Mail : <?php the_field('cial_email'); ?></p>
    			<p>Téléphone : <?php the_field('cial_telephone'); ?></p>
    			<?php if( get_field('cial_das') ):?>
    			<p>Univers : <?php the_field('cial_das'); ?></p>
    			<?php endif; ?>			
    		</div>
    
    You can see the result at the bottom of this page : http://festilight.com/festilight-deco
    
    For exemple if you select "Atlantique", all the informations are good and visible.
    
    When I add 
    
    <code><p>Univers : <?php the_field('cial_secteur'); ?></p></code>
    
    (there is a mistake, it's not "Univers :" but "secteur" it's like "localization :" in english but it's not a problem for now)
    
    So 

    <p>Univers : <?php the_field(‘cial_secteur’); ?></p>

    That break my page and don’t show my footer.

    #193238

    Trevor
    Participant

    At the moment, this line:

    <p>Univers : <?php the_field('cial_secteur'); ?></p>

    Produces text like:

    Univers : Atlantique

    Yes?

    What does

    <?php $cial_sector = get_field('cial_secteur');
    echo $cial_sector('cial_das');?>

    Give you?

    #193158

    Trevor
    Participant

    You are trying to fetch the field data from a related Post Object?

    So, your results Post might be ID #1234

    But the Post Object found is ID #5678

    So, when you use get_field, it must be like this:

    get_field('cial_das', 5678)

    So you must first find the ID of the relationship object to enable a lookup to be performed.

    #170723

    Trevor
    Participant

    These fields are made with ACF Pro?

    If so, you use get_field, like this:

    <?php
    $value = get_field( "text_field" );
    if( $value ) {
      echo $value;
    } else {
      echo 'empty';
    }
    ?>
    #139818

    Trevor
    Participant

    Hi

    Your code isn’t inside back ticks (code ticks) so it is hard to read, so I have recoded it here, and towards the end added a line to remove the final comma that the code adds (it adds the ID plus a comma each time, but the last comma is not needed):

    <?php
    $map_sc_text='[wpgmza id="5" mashup=true mashup_ids="';
    
    while ($query->have_posts())
    {
    $query->the_post();
    
    ?>
    <div>
    <h2><?php the_title(); ?></h2>
    
    <p><br /><?php the_excerpt(); ?> </p>
    <?php
    if ( has_post_thumbnail() ) {
    echo '<p>';
    the_post_thumbnail("small");
    echo '</p>';
    }
    ?>
    <p><?php the_category(); ?></p>
    <p><?php the_tags(); ?></p>
    
    </div>
    
    <hr />
    <?php
    
    $map_sc_text.=get_field('hotel_map_id').',';
    }
    $map_sc_text=substr($map_sc_text,0,-1);
    $map_sc_text.='" parent_id="5"]';
    do_shortcode($map_sc_text);
    
    ?>

    Does that work?

    #139694

    Anonymous
    Inactive

    Hi Trevor,

    Thanks to your amazing help, I was able to also make something like this work with that maps plugin you mention above.

    Here’s the maps code I placed on the results.php page in my child theme (the ACF field for the map ID is called “hotel_map_id”):

    <?php
    $map_sc_text='[wpgmza id=”5″ mashup=true mashup_ids=”‘;

    while ($query->have_posts())
    {
    $query->the_post();

    ?>
    <div>
    <h2>“><?php the_title(); ?></h2>

    <p><br /><?php the_excerpt(); ?> </p>
    <?php
    if ( has_post_thumbnail() ) {
    echo ‘<p>’;
    the_post_thumbnail(“small”);
    echo ‘</p>’;
    }
    ?>
    <p><?php the_category(); ?></p>
    <p><?php the_tags(); ?></p>

    </div>

    <hr />
    <?php

    $map_sc_text.=get_field(‘hotel_map_id’).’,’;
    }

    $map_sc_text.='” parent_id=”5″]’;
    do_shortcode($map_sc_text);

    ?>

    However, even though the functionality is perfect, I now get this error (only on the search and results page, not the whole site):

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/wp-google-maps-pro/wp-google-maps-pro.php on line 3570.

    Did you by any chance come across this issue when you were doing this? If so, how did you fix it?

    Thank you so so much!

    Maria

Viewing 10 results - 51 through 60 (of 90 total)