Support

Account

Forum Replies Created

  • I have now solved the whole thing completely different!
    Instead of a table I opted for a dynamic container … looks more elegant and makes the whole thing much easier in connection with ACF!

  • I have created an extra field for image descriptions (image_description)
    the whole thing is integrated with me with <figcaption>

    		<div class="druckerimage">
    			<?php $image = get_field('image');
    				if( !empty($image) ): ?>
    					<figure class="gesamt">
    						<img src="<?php the_field('image'); ?>" alt="<?php the_field( 'modell' ); ?>" class="druckerimg" />
    						
               				<figcaption><?php the_field( 'image_description' ); ?></figcaption>
    
          				</figure>
    
    			<?php endif; ?>
    		</div>
    		

    maybe this will help you?!?

  • i found the solution!

    After hours of searching, I found a post on stackoverflow.com

    1) create text field in acf. example : text field name is video_url

    2) Please enter a youtube video link in acf text field.

    3) show anywhere in wordpress template page

  • okay i think i found the bug.
    I have now selected “Single-line text” as the field type for the import.

    <?php if( get_field('image') ): ?>
        <img src="<?php the_field('image'); ?>" />
    <?php endif; ?>

    So the picture is now also shown to me.

    I think I will now add an “if query” to ask whether an image is “uploaded” as text, or in the traditional way using the field type “image”.

    Or are there suggestions for improvement?

  • Yes that’s right. But it doesn’t work …
    with what needs to be heard here?

    <?php
      $ad_args = array(
        'post_type'       => '3d_drucker',
        'orderby'         => 'rand',
        'meta_query'      => array(
          array(
            'key'     => '3ddruck-verfahren',
            'value'   => 'SLS',
          )
        )
      );
    
    // query
    $ad_query = new WP_Query($ad_args);
    ?>
  • this doesn’t give me an error, but nothing is shown …

    function ts_add_iframe_video() {
         
        $output = '<div class="woocommerce-product-gallery images">';
    	$iframe = get_field('produktvideo-url');
    	
    	// Use preg_match to find iframe src.
    	preg_match('/src="(.+?)"/', $iframe, $matches);
    	$src = $matches[1];
    	
    	// Add extra parameters to src and replcae HTML.
    	$params = array(
        'controls'  => 0,
        'hd'        => 1,
        'autohide'  => 1
    	);
    	$new_src = add_query_arg($params, $src);
    	$iframe = str_replace($src, $new_src, $iframe);
    	
    	// Add extra attributes to iframe HTML.
    	$attributes = 'frameborder="0"; allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen';
    	$iframe = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);
            // Replace your iframe code from youtube here.
        $output .=  'echo $iframe;';
        $output .= '</div>';
         
        echo $output;
    }
  • short update: I have now acquired acf pro.
    I think that should make everything easier. However, I still do not know exactly how to implement this.

  • Hey bosoxbill,
    thanks for your answer!

    unfortunately with this code my table remains empty …
    but with that you gave me food for thought.

    i got it!
    the following code works!

    $filamente = '';
    $filament = get_field('filament');
    if ($filament) {
      $filamente = implode(', ', $filament);
    }
    echo "<td>$filamente </td>";
    
  • I’m still not further … I found the following code, but it only shows “array” …. really stupid

        $filamente = get_field( 'filament' );
    		foreach($filamente as $filament):
    	$filament_fields = get_field('$filament', $filament);
    	if( $filamente_fields ):
    		$filament_fields_slugs = array_column($filament_fields, 'slug');
            $data_filament_slugs = implode(', ', $filament_fields_slugs);
    	endif;
    endforeach;
  • `<?php
    $field = get_field_object(‘farben’);
    $colors = $field[‘value’];
    if( $colors ): ?>
    <?php foreach( $colors as $color ): ?>
    <div style=”float: left; width: 10px; height: 10px; margin-right: 3px; border: 1px solid #000000; background-color:<?php echo $color; ?>”></div>
    <?php endforeach; ?>
    <?php endif; ?>`

    This works!
    Thank You!

  • nearly…. 😀

    I once looked at the console and found that as a color code only one “#” is output …. without, for example, ffffff

  • edit: I’ve got it, that the individual boxes of the colors are displayed. However, these are now empty …. do we have to work with an array here?

    
            <?php
    $colors = get_field('farben');
    if( $colors ): ?>
        <?php foreach( $colors as $color ): ?>
            <div style="float: left; width: 10px; height: 10px; margin-right: 3px; border: 1px solid #000000; background-colo:-<?php echo $color['value']; ?>"></div>
        <?php endforeach; ?>
    <?php endif; ?> 
    

    https://ibb.co/txy4jh2

  • Impressive! I think that will get me much further.
    but somewhere you have to have made a mistake.
    maybe you forgot a quotation mark? (“) or too much?

    what I have already managed is that the “color codes” are displayed. but only with “#”.
    So not: #ffffff, just #
    (but at least only as many as colors are available for the material)

    my current code looks like this:

    
    				<?php
    $colors = get_field('farben');
    if( $colors ): ?>
    
        <?php foreach( $colors as $color ): ?>
            <div style="background-color:<?php echo $color['value']; ?>"><?php echo $color['label']; ?></div>
        <?php endforeach; ?>
    
    <?php endif; ?>	
    

    I would like to have the colors shown in small boxes.

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