This topic has 10 replies, 2 voices, and was last updated 7 years by Laura.

  • Author
  • #156909
     wilfriedMarseille
    Participant

    Hello,
    I follow a tutorial to make my own template for a Custom post Type.

    So i need to make a new page template
    ( I make a question before aout it )

    And after i need to make a single-my-slug-ame.php

    I just to replace the
    get_template_part( ‘template-parts/content’, ‘page

    by

    get_template_part( ‘content-telechargement’ );

    But i don’t find this line on the single.php from KLEO.

    So what is the line than i need to change to do it.
    I let you the code

    If you love Ableton check my blog :
    www.zikrea.com

    #156910
     wilfriedMarseille
    Participant

    single.telechargement.php

    COPY CODE
    <?php
    /**
     * The Template for displaying all single posts
     *
     * @package WordPress
     * @subpackage Kleo
     * @since Kleo 1.0
     */
    
    get_header(); ?>
    
    <?php
    //Specific class for post listing */
    if ( kleo_postmeta_enabled() ) {
    	$meta_status = ' with-meta';
    	if ( sq_option( 'blog_single_meta', 'left' ) == 'inline' ) {
    		$meta_status .= ' inline-meta';
    	}
    	add_filter( 'kleo_main_template_classes', create_function( '$cls','$cls .= "' . $meta_status . '"; return $cls;' ) );
    }
    
    /* Related posts logic */
    $related = sq_option( 'related_posts', 1 );
    if ( ! is_singular('post') ) {
        $related = sq_option( 'related_custom_posts', 0 );
    }
    //post setting
    if(get_cfield( 'related_posts') != '' ) {
    	$related = get_cfield( 'related_posts' );
    }
    ?>
    
    <?php get_template_part( 'page-parts/general-title-section' ); ?>
    
    <?php get_template_part( 'page-parts/general-before-wrap' );?>
    
    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
        <?php get_template_part( 'content', get_post_format() ); ?>
    
            <!-- Begin Comments -->
            <div class="aligncenter">
    			<h4 class="titleComments">Une question, une remarque, un avis ?</h4>
    			<h4>Laissez nous un commentaire.</h4>
    		</div>
        <?php
    	if ( comments_open() || get_comments_number() ) {
    		comments_template( '', true );
    	}
    	?>
        <!-- End Comments -->
    
    		<?php get_template_part( 'page-parts/posts-social-share' ); ?>
    
    		<?php 
    		if( $related == 1 ) {
    			get_template_part( 'page-parts/posts-related' );
    		}
    		?>
    
    		<?php
            if ( sq_option( 'post_navigation', 1 ) == 1 ) :
                // Previous/next post navigation.
                kleo_post_nav();
            endif;
    		?>
    
    <?php endwhile; ?>
    
    <?php get_template_part('page-parts/general-after-wrap');?>
    
    <?php get_footer(); ?>

    If you love Ableton check my blog :
    www.zikrea.com

    #156911
     wilfriedMarseille
    Participant

    Sorry

    In reality I just copy the single.php and i rename it with my single-slug-name.php
    And i have to remake my own template directly without change this famous line.

    But i have a second question.

    In my custom post type I put some Advanced custom Fields.
    I try to show it in front end but i don’t get it.

    I have the <h1>Tototot</h1>
    But with the
    <h2><?php if (get_field(‘logiciel’)) ?></h2>
    <h2><?php if (get_field(‘lien_youtube’)) ?></h2>

    I don’t see the field in front end.

    I let you the code and the link to see the demo is :

  • http://www.zikrea.com/telechargements/dgf/
  • COPY CODE
    <?php
    /**
     * The Template for displaying all single posts
     *
     * @package WordPress
     * @subpackage Kleo
     * @since Kleo 1.0
     */
    
    get_header(); ?>
    
    <?php
    //Specific class for post listing */
    if ( kleo_postmeta_enabled() ) {
    	$meta_status = ' with-meta';
    	if ( sq_option( 'blog_single_meta', 'left' ) == 'inline' ) {
    		$meta_status .= ' inline-meta';
    	}
    	add_filter( 'kleo_main_template_classes', create_function( '$cls','$cls .= "' . $meta_status . '"; return $cls;' ) );
    }
    
    /* Related posts logic */
    $related = sq_option( 'related_posts', 1 );
    if ( ! is_singular('post') ) {
        $related = sq_option( 'related_custom_posts', 0 );
    }
    //post setting
    if(get_cfield( 'related_posts') != '' ) {
    	$related = get_cfield( 'related_posts' );
    }
    ?>
    
    <?php get_template_part( 'page-parts/general-title-section' ); ?>
    
    <?php get_template_part( 'page-parts/general-before-wrap' );?>
    
    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
        <?php get_template_part( 'content', get_post_format() ); ?>
        <h1>totopto</h1>
    
        <h2><?php if (get_field('logiciel')) ?></h2>
        <h2><?php if (get_field('lien_youtube')) ?></h2>
        
            <!-- Begin Comments -->
            <div class="aligncenter">
    			<h4 class="titleComments">Une question, une remarque, 3avis ?</h4>
    			<h4>Laissez nous un commentaire.</h4>
    		</div>
        <?php
    	if ( comments_open() || get_comments_number() ) {
    		comments_template( '', true );
    	}
    	?>
        <!-- End Comments -->
    
    		<?php get_template_part( 'page-parts/posts-social-share' ); ?>
    
    		<?php 
    		if( $related == 1 ) {
    			get_template_part( 'page-parts/posts-related' );
    		}
    		?>
    
    		<?php
            if ( sq_option( 'post_navigation', 1 ) == 1 ) :
                // Previous/next post navigation.
                kleo_post_nav();
            endif;
    		?>
    
    <?php endwhile; ?>
    
    <?php get_template_part('page-parts/general-after-wrap');?>
    
    <?php get_footer(); ?>

    If you love Ableton check my blog :
    www.zikrea.com

#156914
 wilfriedMarseille
Participant

So it’s Okay
I found the good code

For example
“<p><?php the_field(‘lien_youtube’, $term); ?></p>”

But i don’t get the code to do that with a ACF from a taxonomie.

If i put that i got a 404 error page

If you love Ableton check my blog :
www.zikrea.com

#156915
 wilfriedMarseille
Participant

May be is because that :

( check the pic )

You can see all the pages here

If you love Ableton check my blog :
www.zikrea.com

Attachments:
You must be logged in to view attached files.
#156919
 wilfriedMarseille
Participant

And if yes i don’t find the category.php

Wich files i have to copy in my kleo child theme ?

If you love Ableton check my blog :
www.zikrea.com

#156927
 wilfriedMarseille
Participant

So I let you my single-telechargement.php code :

So
I got actually 2 problem
code to sho URL youtube doesn’t go but i got the block, the URL in the inspector.
But no the screen to see the video import from youtube.
this the code :

COPY CODE
    		<div>
    			<iframe width="560" height="315" src=<?php the_field('lien_youtube', $term); ?> frameborder="0" allowfullscreen></iframe>
    		</div>

And Always the same problem say before with the taxanomies ….

So i let you a link to see the Pages.
And i let you the script of my single-telechargement.php

  • http://www.zikrea.com/telechargements/exemple/
  • COPY CODE
    <?php
    /**
     * The Template for displaying all single posts
     *
     * @package WordPress
     * @subpackage Kleo
     * @since Kleo 1.0
     */
    
    get_header(); ?>
    
    <?php
    //Specific class for post listing */
    if ( kleo_postmeta_enabled() ) {
    	$meta_status = ' with-meta';
    	if ( sq_option( 'blog_single_meta', 'left' ) == 'inline' ) {
    		$meta_status .= ' inline-meta';
    	}
    	add_filter( 'kleo_main_template_classes', create_function( '$cls','$cls .= "' . $meta_status . '"; return $cls;' ) );
    }
    
    /* Related posts logic */
    $related = sq_option( 'related_posts', 1 );
    if ( ! is_singular('post') ) {
        $related = sq_option( 'related_custom_posts', 0 );
    }
    //post setting
    if(get_cfield( 'related_posts') != '' ) {
    	$related = get_cfield( 'related_posts' );
    }
    ?>
    
    <?php get_template_part( 'page-parts/general-title-section' ); ?>
    
    <?php get_template_part( 'page-parts/general-before-wrap' );?>
    
    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    
        <?php get_template_part( 'content', get_post_format() ); ?>
    
            <!-- Begin Disposition -->
        	<div class ="aligncenter">
    
        		<h1><?php the_field('telechargement_titre', $term); ?></h1>
        		<p><?php the_field('telechargements_description', $term); ?></p>
        		<div>
        			<iframe width="560" height="315" src=<?php the_field('lien_youtube', $term); ?> frameborder="0" allowfullscreen></iframe>
        		</div>
        		<!-- Les champs à afficher -->
    				<?php //Afficher l'image
    				$image = get_field('image');
    				if( !empty($image) ): ?>
    				<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    				<?php endif; ?> 
        	</div>
    
            <!-- Begin Comments -->
            <div class="aligncenter">
    
    			<h4 class="titleComments">Une question, une remarque, 3avis ?</h4>
    			<h4>Laissez nous un commentaire.</h4>
    		</div>
        <?php
    	if ( comments_open() || get_comments_number() ) {
    		comments_template( '', true );
    	}
    	?>
        <!-- End Comments -->
    
    		<?php get_template_part( 'page-parts/posts-social-share' ); ?>
    
    		<?php 
    		if( $related == 1 ) {
    			get_template_part( 'page-parts/posts-related' );
    		}
    		?>
    
    		<?php
            if ( sq_option( 'post_navigation', 1 ) == 1 ) :
                // Previous/next post navigation.
                kleo_post_nav();
            endif;
    		?>
    
    <?php endwhile; ?>
    
    <?php get_template_part('page-parts/general-after-wrap');?>
    
    <?php get_footer(); ?>

    If you love Ableton check my blog :
    www.zikrea.com

    #156975
     wilfriedMarseille
    Participant

    Hi,

    So it’s okay now 🙂

    Thanks you

    If you love Ableton check my blog :
    www.zikrea.com

    #157008
     Laura
    Moderator

    Hello, did you resolve it?

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #157051
     wilfriedMarseille
    Participant

    Yes 🙂

    If you love Ableton check my blog :
    www.zikrea.com

    #157178
     Laura
    Moderator

    Glad you could resolve it 🙂

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

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

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

    Log in with your credentials

    Forgot your details?