This topic has 9 replies, 2 voices, and was last updated 9 years by HDcms.

  • Author
  • #47405
     HDcms
    Participant

    Hi,

    I love the dynamic aspect of the display of the archive articles
    http://seventhqueen.com/themes/kleo/blog/

    However, I used the ACF fields (video, image) to facilitate the entry of articles by novices members

    1 video article:
    1 field excerp ACF + 1 field video
    1 article image:
    1 excerp field + 1 image field

    Currently no image appears because I do not put feature image.
    Would be possible to help me to make a hook to display the image from ACF field

    Regards

    #47586
     sharmstr
    Moderator

    You’ll have to copy /kleo/page-parts/post-content-masonry.php to your child theme and edit the Video and Image cases.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #47747
     HDcms
    Participant

    HI,
    Thank you 🙂
    I’ll watch.
    I try to centralize all the hacks in functions.php
    The ideal would be to have a function like I did for a post:

    COPY CODE
    function affic_champs_acf_video($content) { /*champs à affichés pour une vidéo */
    $content .='<div class="video, embed-container">';    
    $content .= get_field('video') ;
    $content .='</div>';    
    return $content;
    }
    ...
    if ( $format=== 'video' ) {   
      add_filter('the_content', 'affic_champs_acf_video');  
    }
    #47758
     sharmstr
    Moderator

    There isnt a way to filter it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #48337
     HDcms
    Participant

    Hello,

    Well I have problems. I have
    1) creates a new directory
    wp-content/themes/kleo-child/page-parts
    2) transfer the edited file
    post-content-masonry.php

    There are no video appears

    COPY CODE
    // $k_video .= '<div class="kleo-video-wrap"><video ' . join( ' ', $attr_strings ) . ' controls="controls" class="kleo-video" style="width: 100%; height: 100%;">';
    					$k_video .= '<div class="kleo-video-wrap"><video ' . get_field('video') . ' controls="controls" class="kleo-video" style="width: 100%; height: 100%;">';

    Regards

    #48353
     sharmstr
    Moderator

    Look at the lines above that. Specifically if ( !empty( $bg_video_args ) ) {. That’s going to return false if you didnt adjust the lines above that.

    COPY CODE
    
    if (get_cfield( 'video_mp4' ) ) {
    $bg_video_args['mp4'] = get_cfield( 'video_mp4' );
    }
    if (get_cfield( 'video_ogv' ) ) {
    $bg_video_args['ogv'] = get_cfield( 'video_ogv' );
    }
    if (get_cfield( 'video_webm' ) ) {
    $bg_video_args['webm'] = get_cfield( 'video_webm' );
    }
    
    

    None of those lines are looking for your ‘video’ field, right? So it will never try to execute the line you edited.

    Furthermore, did you adjust the first line in the video case? $video = get_cfield( ’embed’ ); That should probably be something like $video = get_field( ‘video’ );

    I suggest you hire someone who can read and understand the code.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #48935
     HDcms
    Participant

    HI,

    This is the video that it was easier !! 🙂

    COPY CODE
    .... // modif HD OK   
    				$video = get_field('video');
    				// video bg self hosted
    				$bg_video_args = array();
    				$k_video = '';
    
    				if (get_cfield( 'video_mp4' ) ) {
    					$bg_video_args['mp4'] = get_cfield( 'video_mp4' );
    				}
    				if (get_cfield( 'video_ogv' ) ) { ...

    I still can not recover an image of a picture field ACF
    I replace

    COPY CODE
    echo '<a href="'. get_permalink() .'" class="element-wrap">'
                            . '<img src="' . $image . '">' 
                            . kleo_get_img_overlay()
                            . '</a>';

    with
    `$image = get_field(‘ecran-site’);
    echo ‘<a href=”‘. get_permalink() .'” class=”element-wrap”>’
    . ‘<img src=”‘ . $image . ‘”>’
    . kleo_get_img_overlay()
    . ‘</a>’;`

    #49465
     HDcms
    Participant

    Hi,
    I spent unresolved! because it remains to do the same for images

    #49473
     sharmstr
    Moderator

    echo $image and tell me what it prints.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #49521
     HDcms
    Participant

    Hi,
    I replaced

    COPY CODE
    case 'image':
    			default:
    				if ( kleo_get_post_thumbnail_url() != '' ) {
    					echo '<div class="post-image">';
    			
    					$img_url = kleo_get_post_thumbnail_url();
    					$image = aq_resize( $img_url, $kleo_config['post_gallery_img_width'], null, true, true, true );
    					if( ! $image ) {
                            $image = $img_url;
                        }
                        echo '<a href="'. get_permalink() .'" class="element-wrap">'
                            . '<img src="' . $image . '">'
                            . kleo_get_img_overlay()
                            . '</a>';
    					
    					echo '</div><!--end post-image-->';
    				}

    by

    COPY CODE
    	default:
    				$image = get_field('image'); // ok cela fonctionne
                        echo '<a href="'. get_permalink() .'" class="element-wrap">'
                            . '<img src="' . $image . '">' 
                            . kleo_get_img_overlay()
                            . '</a>';				
    				break;

    it seems to work
    I did not understand what use has removed the code.
    I hope this is not a problem! ??

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

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?