Search Results for 'the_field'

Forums › Forums › Search › Search Results for 'the_field'

Viewing 10 results – 61 through 70 (of 85 total)
  • Author
    Search Results
  • #119857

    Anonymous
    Inactive

    The custom content is added in a custom field in the back-end and then called in results.php, before the loop as follows:

    <?php if( get_field('luxury_holidays_content') ): ?>
    
    	<div class="masonry-layout-panel custom-content">
    			
    		<?php the_field('luxury_holidays_content'); ?>
    		
    	</div>
    	
    <?php endif; ?>

    Strangely, if I hard code the custom content in results.php, it is always visible. However, if I call it in PHP as above, it gets removed when a search or form reset is performed.

    #102011

    Anonymous
    Inactive

    Great stuff, how come you are echoeing get_field instead of using the_field?

    The example you provided outputs single fields fine, but what would be some example code to use ACF’s Post Object?

    Using the example ACF site supplies doesnt work as expected.

    #101977

    Anonymous
    Inactive

    Sorry for the badly formatted code, cant see where to edit my post. Here it is formatted a little more readable:

    <?php
    while ($query->have_posts())
    {
    $query->the_post();
    
    ?>
    <tr>
    <td>
    <?php
    
    $post_object = get_field('customer');
    
    if( $post_object ): 
    
    // override $post
    $post = $post_object;
    setup_postdata( $post ); 
    
    ?>
    <?php the_title(); ?>
    <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>
    
    </td>
    <td><?php the_date(); ?></td>
    <td><?php echo the_ID(); ?></td>
    <td><?php echo the_field('reg_no'); ?></td>
    </tr>
    <?php
    }
    ?>
    #101976

    Anonymous
    Inactive

    Hi,
    Im unable to get ACF Post Object fields to output in to the results, any idea’s on the correct format?

    <?php
    					while ($query->have_posts())
    					{
    						$query->the_post();
    						
    						?>
    						<tr>
    							<td>
    								<?php
    
    							$post_object = get_field('customer');
    
    							if( $post_object ): 
    
    								// override $post
    								$post = $post_object;
    								setup_postdata( $post ); 
    
    								?>
    							    <?php the_title(); ?>
    							    <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
    							<?php endif; ?>
    
    							</td>
    							<td><?php the_date(); ?></td>
    							<td><?php echo the_ID(); ?></td>
    							<td><?php echo the_field('reg_no'); ?></td>
    						</tr>
    						<?php
    					}
    					?>

    At the moment “the_title” inside the post object, outputs the title of the search result, not the title thats defined inside the search result post.

    Hopefully that makes sense, and hopefully its just a syntax issue.

    Thanks,
    Mike

    #96357

    Anonymous
    Inactive

    Hi!

    Great plugin, but I’m having a problem right now.
    Everything is working with a search box and filters, but when I use (in this case) the infinite scroll option, every post that loads gets a changed permalink.

    The code I use within the ‘while’ loop for a post is this:

    <div class="item route">
                                        <div class="item-image">
                                            <a href="<?php the_permalink(); ?>">
                                                <?php the_post_thumbnail('formatted'); ?>
                                                <div class="item-image-overlay"></div>
                                            </a>
                                            <h3 class="item-title"><?php the_title(); ?></h3>
                                        </div>
                                        <!--<div class="item-price"></div>
                                        <div class="price-tag">
                                            <span>vanaf</span>
                                            <span class="price">&euro; 59,<sup>50</sup></span>
                                            <span>p.p.</span>
                                        </div>-->
                                        <div class="item-content">
                                            <h4><?php echo $arrCity; ?><?php echo $arrProvince; ?><?php echo $arrRegion; ?></h4>
                                            <?php the_field('korte_omschrijving'); ?>
    
                                        </div>
                                        <div class="item-more">
                                            <a href="<?php echo $permalink; ?>" class="btn btn-block ajax" data-url="<?php the_permalink(); ?>" data-title="<?php the_title(); ?>">Bekijk route <i class="fa fa-angle-right" aria-hidden="true"></i></a>
                                        </div>
                                    </div>

    The problem is that ‘the_permalink()’ is changed.
    A piece of code is added by the plugin, e.g. permalink/?sf_paged=2.
    I really need to get rid of the added code because I use Ajax to load the content of that post in a modal.

    Hopefully my problem is clear enough.
    Thanks in advance!

    Alex

    #94498

    Trevor
    Participant

    Yes, this is possible. The snippet that inserts the thumbnail in your code is this:

    <?php 
      if ( has_post_thumbnail() ) {
        echo '<span class="responsive">';
        the_post_thumbnail("small");
        echo '</span>';
      }
    ?>

    (Note that many people change the ‘small’ to ‘thumb’ to load and even smaller image)

    To output this as an image linked to the post, the code would be this:

    <?php
      if ( has_post_thumbnail() ) { ?>
        <span class="responsive"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail("small");?></a></span>
      <?php	} ?>

    I am not sure about your use of span to add the responsive bit. In my theme (bootstrap based) it adds img-responsive this way:

    <?php the_post_thumbnail("small", array( 'class' => 'img-responsive' ));?>
    

    In your case, I do not know what your field is, but your code to output that field needs to replace <?php the_permalink(); ?> in this. Maybe like this <?php the_field('artistpage'); ?>

    #84202

    Anonymous
    Inactive

    Hi,

    Just bought and read the docs but i’m not following here.

    This is a piece from one template file in my theme:

    <section id="events-lijst">
    
        <?php
          // the query
        $options = array(
        'post_type' => 'event',
        'posts_per_page' => 20,
        'order' => 'ASC',
        'meta_key'		=> 'taal',
    	  'meta_value'	=> 'Nederlands'
        );
        $query = new WP_Query( $options );
        ?>
    
        <?php if ( $query->have_posts() ) : ?>
    
        <div class="container">
          <div class="eventrow">
      	     <?php while ( $query->have_posts() ) : $query->the_post(); ?>
    
               <div class="panel panel-default">
               		<div class="panel-heading">
                    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                  </div>
                  <div class="event-foto-sectie">
                    <?php $uitgelichte_afbeelding = get_field( 'uitgelichte_afbeelding' ); ?>
                    <?php if ( $uitgelichte_afbeelding ) { ?>
                    <a href="<?php the_permalink(); ?>"><img src="<?php echo $uitgelichte_afbeelding['url']; ?>" class="event-featured-img" alt="<?php echo $uitgelichte_afbeelding['alt']; ?>" /></a>
                    <?php } ?>
                  </div>
               		<div class="panel-body">
                    <?php
                    $dateformatstring = "l d F, Y";
                    $unixtimestamp = strtotime(get_field('datum'));
                    ?>
                    <p><strong>Datum: </strong> <?php echo date_i18n($dateformatstring, $unixtimestamp); ?><br/><strong>Locatie: </strong><?php the_field( 'locatie' ); ?></p>
                    <span class="eventuitleg"><?php the_excerpt(); ?></span>
                    <p class="bekijkevent"><strong><a href="<?php the_permalink(); ?>">Bekijk dit evenement</a> >></strong></p>
                  </div>
               	</div>
    
             <?php endwhile; ?>
    
          </div>
    
        </div>
    
      	<?php wp_reset_postdata(); ?>
    
      <?php else : ?>
        <section class="section-padding">
        <div class="container">
          <div class="row-centered">
            <div class="col-md-12 col-centered">
                <strong>Sorry, geen enkel event geprogrammeerd op dit ogenblik...</strong>
            </div>
          </div>
        </div>
        </section>
      <?php endif; ?>
    
    </section><!-- event lijst -->

    I want to put a row at the top where my query underneath is filterd on custom fields (using ACF)

    #65274

    Anonymous
    Inactive

    Hi,
    How could I order results by ACF type of field “powierzchnia”?

    <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
         
                <a href="<?php the_permalink(); ?>">
               
                <ul>
                    <li><?php the_title(); ?></li>
                    
                    <?php if (get_field ('powierzchnia') ) : ?>
                                            <li><span><?php echo the_field ('powierzchnia'); ?></span> m<sup>2</sup></li>
                                        <?php endif; ?>

    Regards

    #63425

    In reply to: ACF and CPT output


    Anonymous
    Inactive

    I got my results themed by altering the plugins/search-filter-pro/templates/results.php file, but this is not ideal. I have created mythemename/search-filter-pro/templates/results.php and mythemename/search-filter/templates/results.php but neither of these is being loaded.
    If you have a url where any of this is explained, it would be appreciated.
    In the meantime, I did get a custom field, named location, wrapped by adding this to results.php in the plugin folder:
    <div class="customtest"><?php the_field('location'); ?></div>

    #62153

    In reply to: Doesn't referesh


    Anonymous
    Inactive

    Hi Trevor,

    My code:

    <div id="results">
                            <?php query_posts($query_string . "&meta_key=premium&orderby=meta_value"); ?>
                            <?php while (have_posts() ) : the_post(); ?>
                                <div class="<?php
                                    if (get_field('premium')) {
                                        echo 'premium';
                                    }
                                    ?> row-fluid padM marginDownS bRadiusM brightenCat resumenFicha">
                                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
                                        <div class="col-md-4 col-sm-6 col-xs-2 erasePad">
                                            <?php the_post_thumbnail( 'medium', array('class' => 'img-responsive bRadiusM')); ?>
                                        </div>
                                        <div class="col-md-8 col-sm-6 col-xs-10">
                                            <h4 class="text-left secondColor textSizeM">
                                                <?php if (in_category (array ('playas', 'municipios'))): ?>
                                                    <?php the_title(); ?>
                                                <?php else: ?>
                                                    <?php the_title(); ?>
                                                <?php endif ?>
                                            </h4>
                                            <p class="textSizeS mainColor esconder_xs">
                                                <?php the_field('ciudad'); ?>
                                                <?php the_field('cul_ciudad'); ?>
                                                <?php the_field('en_municipio'); ?>
                                                <?php the_field('rut_salida'); ?>
                                                <?php the_field('pn_municipios'); ?>
                                            </p>
                                            <div class="esconder_xs">     
                                                <?php the_excerpt(array('class' => 'greyFont')); ?>
                                            </div>
                                        </div>          
                                    </a>
                                </div>
                            <?php endwhile;?>
                            <div id="pagination"> 
                                <?php wp_pagenavi( ); ?>  
                            </div>
                        </div>

    #results is set to “result container”.

    And there are no javascripts errors… only two 404 getting a old image.

    Thanks

    rgds

Viewing 10 results – 61 through 70 (of 85 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.