Forums Forums Search Search Results for 'the_field'

Viewing 10 results - 31 through 40 (of 64 total)
  • Author
    Search Results
  • #204888

    Trevor
    Participant

    Ah, I think I can see. It is the structure of the template, and a few errors in the HTML. Try something like this:

    <?php
    get_header();
    
    ?>
    <div class="page-body style-light-bg">
    	<div class="post-wrapper">
    
            <div class="row row-parent col-std-gutter double-top-padding no-bottom-padding limit-width">
    
    <div class="col-lg-8">
    <div class="post-content style-light double-bottom-padding">
    		
    
    <?php if ( have_posts() ) : ?>
    <tbody class='search-filter-results-list'>
    <table>	
    <tr>
    <td>
         <p>File</p>
    </td>
    <td>
         <p>Name</p>
    </td>
    <td>
         <p>Language</p>
    </td>
    <td>
         <p>Publish Date</p>
    </td>
    <td>
         <p>Download</p>
    </td>
        
    <?php while ( have_posts() ) : the_post(); ?>
    </tr>
    <tr class='search-filter-result-item'>
    
    <td>
         <img src="<?php the_field('file_icon'); ?>" />
    </td>
    <td class="ptitle">
        <a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a>
    </td>
    <td>
        <img src="<?php the_field('language'); ?>" />
    </td>
    <td>
        <?php the_field('publish_date'); ?>
    </td>
    <td>
        <a href="<?php the_field('download'); ?>" target="_blank">Download</a>
    </td>
    
    <?php endwhile; else : ?>
    </tr>
    </table>
    </tbody>
    <?php endif; ?>
    
    </div>
    </div>
    
    		<div class="col-lg-4">
       			<div class="uncol style-light">
          			<div class="uncoltable">
             			 <?php get_sidebar(); ?>
          			</div>
       			</div>
    		</div>
    	</div>
    	</div>
    </div>
    
    										
    <?php get_footer(); ?>

    Then, I have edited the form for you:

    https://www.screencast.com/t/uFpF3rDL4MPg


    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!

    #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.

    #197661

    Trevor
    Participant

    Please note that we are now into a holiday period in the UK. We will be working for some of this period, but replies may be delayed at times.

    With regard to custom work, we do not offer that service. You would need to hire a freelance coder. Sites such as codeables.io are a good place to look.

    If you use the Advanced Custom Fields plugin to create the custom field, and are using our Shortcode Display Results method (or use a similar PHP template file), a custom field is out put like this:

    <h4 class="my_custom_heading_class">My Custom Field Title: 
    <?php the_field('my_custom_field_name'); ?></h4>

    Trevor
    Participant

    The Not Loading issue is this:

    Fatal error: Call to undefined function the_field() in /storage/content/78/125678/dev.frakka.se/public_html/wp-content/plugins/search-filter-pro/templates/results.php on line 82

    I would take a look at that file and that line to find the error. If it is the standard results.php file, it is this:

    if (function_exists('wp_pagenavi'))
    {

    Do you have the WP-PageNavi plugin installed?

    Temporarily change the form from Shortcode to Custom will stop the error whilst you try to fix it.

    I am not sure what the failure to update is. You could try a manual update (download the file from Your Account area, deactivate and delete the existing version, and upload and install the new version).

    #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?


    Anonymous
    Inactive

    That’s all working. Great. Thanks!

    Now I’d like to try to make it work with Ajax. All my settings are the same as above except I’ve selected the Authors post type and unselected Posts.

    When I select Load results using Ajax, then the filter doesn’t work.

    I’m doing all this on a page with the following content:

    [searchandfilter id="154"]
    
    [searchandfilter id="154" show="results"]

    And this page uses this custom template, which queries the db to get category names, then within each category queries to get posts. FYI each post can only have one category. Otherwise I’m aware that a given post could show up more than once on the page.:

    <?php
    /* template name: Authors Page */
     ?>
    <?php get_header(); ?>
     <div id="layout" class="pagewidth clearfix">
         <div id="content" class="authors-page clearfix">
        <?php
        //echo do_shortcode('[searchandfilter id="154"]');
        // get all the categories from the database
        $cats = get_categories(); 
    	// loop through the categries
    	foreach ($cats as $cat) 
    		{
    		// setup the cateogory ID
    		$cat_id= $cat->term_id;            // create a custom wordpress query
    		$args = array('post_type' => 'authors', 'cat' => $cat_id, 'meta_key' => 'author_last_name', 'orderby' => 'meta_value', 'order' => 'asc');
    		$args['search_filter_id'] = 154;
    		$query = new WP_Query($args);
    		$count = $query->found_posts;
    		if($count > 0) //fix this to test if there are any results (numrows > 0)
    			{
    			// Make a header for the cateogry
    			echo "<h2 class=\"category-name background\" style=\"clear:both\"><span>".$cat->name."</span></h2>";
    			}
    ?>
                        
         <div id="loops-wrapper" class="loops-wrapper sidebar1 grid3  boxed masonry infinite masonry-done blog" style="position: relative; height: 640.234px;">
         <div class="grid-sizer"></div>
         <div class="gutter-sizer"></div>
        <?php
        // start the wordpress loop!
     	if ( $query->have_posts() ) : ?>
    		<?php while ( $query->have_posts() ) : $query->the_post(); ?>	
    			<article id="post-<?php echo get_the_ID();?>" class="post clearfix post-<?php echo get_the_ID();?> type-post status-publish format-standard has-post-thumbnail hentry category-featured-authors has-post-title no-post-date " style="position: absolute; left: 0px; top: 500px;">
    			 <figure class="post-image  clearfix">
    				<a href="<?php the_permalink();?>"><img src="<?php echo get_the_post_thumbnail_url(); ?>" class=" wp-post-image wp-image-84" alt="<?php the_title(); ?>" srcset="" sizes="(max-width: 200px) 100vw, 200px" width="200" height="150"><img src="<?php the_field('featured_book_cover_image'); ?>" class="featured_title_cover_image" width="100" height="150"></a>
    				<a href="<?php echo esc_url( get_permalink() ); ?>" class="overlay">
    				<div class="excerpt-text"><?php the_field('mini_blurb'); ?></div>
    				</a>
    			  </figure>
    			  <div class="post-content">
    				<div class="post-content-inner">
    				<!-----------------ICON----------------->
    					<!--<span class="<?php if($on_list) { echo $icon_class; } ?> tooltips author-tooltips add_<?php echo get_the_ID();?> list-icon"  title="<?php echo $element_title; ?>">
    						<?php if(!$on_list) { ?><a href="#" class="<?php echo $icon_class; ?> btnAddAction" onclick = "cartAction('<?php echo $action; ?>','<?php echo get_the_ID();?>')"></a> <?php } ?>
    					</span>	-->
    				   <!-----------------/.ICON------------------>
    					<h2 class="post-title entry-title"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2>
    					<div class="entry-content">
    					   <?php the_field('featured_book_title'); ?>
    					</div><!-- /.entry-content -->
    				</div><!-- /.post-content-inner -->
    			  </div><!-- /.post-content -->
    		 </article>
    		<?php endwhile; wp_reset_postdata(); ?>
    		<!-- show pagination here -->
    	<?php else : ?>
    		<!-- show 404 error here -->
    	<?php endif; ?>
        </div><!-- #loops-wrapper -->
    <?php } // done the foreach statement ?>
    
    	</div><!-- #content -->
    </div><!-- #layout -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    This all works fine, except when I set it to use Ajax.

    Thanks.

    #184187

    Anonymous
    Inactive

    I’ve created a page template that shows categories and then posts within those categories. I’d like to use this template to display Search and Filter results, with the S&F form at the top of the page.

    I’ve tried putting the shortcode from the form in the content of the page that uses the custom template described above. And I’ve tried the Display as Archive technique. Still no form showing.

    Below is the code for the template. Is there any reason this can’t work as a template for displaying S&F results? Thanks.

    <?php
    /* template name: Authors Page Test */
     ?>
    <?php get_header(); ?>
     
    <div id="container">
        <div id="content" role="main">
    
        <?php
        // get all the categories from the database
        $cats = get_categories(); 
    
            // loop through the categries
            foreach ($cats as $cat) {
                // setup the cateogory ID
                $cat_id= $cat->term_id;
                // Make a header for the cateogry
                echo "<h2>".$cat->name."</h2>";            // create a custom wordpress query
                query_posts("cat=$cat_id&posts_per_page=100");
                // start the wordpress loop!
                if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                    <?php // create our link now that the post is setup ?>
                    <a href="<?php the_permalink();?>"><?php the_title(); ?></a>
                    <img name="" src="<?php echo get_the_post_thumbnail_url(); ?>" width="200" alt="">
                    <img src="<?php the_field('featured_book_cover_image'); ?>" class="featured_title_cover_image" width="100" height="150" />
                    <?php the_field('featured_book_title'); ?>
                    <?php echo '<hr/>'; ?>
    
                <?php endwhile; endif; // done our wordpress loop. Will start again for each category ?>
            <?php } // done the foreach statement ?>
    
        </div><!-- #content -->
    </div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    #180880

    Trevor
    Participant

    I had not realised you were using ACF this time round. You are correct, the_field() is one method you can use. Sometimes it also needs the post ID in there as the second argument. Maybe

    <?php echo the_field('fieldname',get_the_ID());?>
    

    Note, for ACF, the fieldname never starts with an underscore.

Viewing 10 results - 31 through 40 (of 64 total)