Support

Account

Forum Replies Created

  • Thanks, that’s done.

    I would like to get each value its own color.

    Like:

    Café = red
    Restaurang = blue
    Bar = black
    Gårdsbutik = grey

  • Sorry, do not have a clue.
    I’m not so good at this so deep encoding so I have more or less just cut in and tested all possible variants without really understanding what I do.

    I would like to do the following

    ACF

    It is a result list.

    First I want to retrieve a user if there is one.
    If not, I want to retrieve a relationship that is a custom post type named forare (drivers).

    Then I want to get the results that are sub fields and that’s just the ones I’ve got it right. 🙂

  • Thanks. I have tested all the examples on the page and also a relationship that I have on another page without repeaters. But I get no work. This is how my last attempt looks.

    
    <?php if( have_rows('resultat_2015_r1') ): ?>
    
    	<ul class="slides">
        
    	<?php while( have_rows('resultat_2015_r1') ): the_row(); 
    
    		// vars
    		$image = get_sub_field('image');
    		$content = get_sub_field('content');
    		$link = get_sub_field('link');
    	
    		
    		
    		the_sub_field('resultat_r1_placering');
    		
    		
    		the_sub_field('resultat_r1_poang');
    		
    	
    
    						/*
    						*  Query posts for a relationship value.
    						*  This method uses the meta_query LIKE to match the string "123" to the database value a:1:{i:0;s:3:"123";} (serialized array)
    						*/
    
    						$forare = get_posts(array(
    							'post_type' => 'forare',
    							'meta_query' => array(
    								array(
    									'key' => 'tavlingsforare_post', // name of custom field
    									'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
    									'compare' => 'LIKE'
    								)
    							)
    						));
    
    						?>
    						<?php if( $forare ): ?>
    							<ul>
    							<?php foreach( $forare as $forare ): ?>
    								
    								<li>
    									<a href="<?php echo get_permalink( $forare->ID ); ?>">
    										
    										<?php echo get_the_title( $forare->ID ); ?>
    									</a>
    								</li>
    							<?php endforeach; ?>
    							</ul>
    						<?php endif; 
    
    		?>
    
            
            
    		<li class="slide">
            
            
    
    			<?php if( $link ): ?>
    				<a href="<?php echo $link; ?>">
    			<?php endif; ?>
    
    				<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
                    
                    
    
    			<?php if( $link ): ?> 
    				</a>
    			<?php endif; ?>
                
                	
    
    		    <?php echo $content; ?> innehåll - tavlingsforare_post
                
            
                
    
    		</li>
    
    	<?php endwhile; ?>
    
    	</ul>
    
    <?php endif; ?>
    
  • Hi Giu Tae Kim!
    “If someone is interested I’ll try to explain the basics…”
    Please do.

    I know there are a couple of years ago but I hope you see that I respond and you still remember how you did. 🙂

    I can the base in some of the coding, but most cut and paste until it works.

    I have not really understood how I should begin. I mix of knowledge from the search form and WP_Query.

    Grateful for answers.
    Best wishes Elle

Viewing 6 posts - 1 through 6 (of 6 total)