Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter frankorev

    (@frankorev)

    Thanks for your reply.
    It works.
    Thanks a lot for your help.

    Thread Starter frankorev

    (@frankorev)

    ok this is loop-film.php :

    <?php 
    	global $graphene_settings; 
    	$post_type = get_post_type_object( get_post_type() );
    ?>
    <?php 
    /**
     * Check if the post has a post format. Load a post-format specific loop file,
     * if it has. Continue with standard loop otherwise.
    */ 
    if ( function_exists( 'get_post_format' ) ) {
    	global $post_format;
    	$post_format = get_post_format();
    	
    	// Get the post formats supported by the theme
    	$supported_formats = get_theme_support( 'post-formats' );
    	if ( is_array( $supported_formats ) ) $supported_formats = $supported_formats[0]; 
    	
    	if ( in_array( $post_format, $supported_formats ) ) {
    		
    		// Get the post format loop file
    		get_template_part( 'loop-post-formats', $post_format );
    		
    		// Stop this default posts loop
    		return;
    	}
    }
    ?>
    
    <?php /* Post navigation */ ?>
    <?php graphene_post_nav(); ?>
            
    <div id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix post' ); ?>>
    	
    	<?php do_action( 'graphene_before_post' ); ?>
    	
    	<div class="entry clearfix">
        	
            <?php /* Post date */ ?>
            <?php if ( stristr( graphene_post_date_setting( get_the_ID() ), 'icon' ) ) graphene_post_date(); ?>
    		
            <?php /* Show the post author's gravatar if enabled */
    		if ( $graphene_settings['show_post_avatar'] ) {
    			echo '<div class="post-avatar-wrap gutter-left">' . get_avatar( get_the_author_meta( 'user_email' ), 45 ) . '</div>';
    		} 
    		?>
            
            <?php 
    		/* Add a print button only for single pages/posts 
    		 * and if the theme option is enabled.
    		 */
    		if ( $graphene_settings['print_button'] ) : ?>
    			<?php graphene_print_button( $post_type ); ?>
    		<?php endif; ?>
            
            <?php /* Add an email post icon if the WP-Email plugin is installed and activated */
    			if( function_exists( 'wp_email' ) ) { echo '<p class="email wp-email-button">'; email_link(); echo '</p>'; }
    		?>
            
    		<?php /* Post title */ ?>
            <h1 class="post-title-film">
    			<?php if ( get_the_title() == '' ) { _e( '(No title)', 'graphene' ); } else { the_title(); } ?>
    			<?php do_action( 'graphene_post_title' ); ?>
            </h1>
    		
    		<?php /* Post meta */ ?>
    		<div class="post-supercat">		<strong>ANN&EgraveE DE PARTICIPATION AU PriMed : </strong>
    		<?php                  the_terms( $post->ID, 'a-participation' ,  '' );                    ?>		<br/>		<strong>CATEGORIE D'INSCRIPTION : </strong>		<?php                  the_terms( $post->ID, 'cat_inscription' ,  '' );                    ?>			</div>		
    			<?php /* Edit post link, if user is logged in */ ?>		<div class="post-meta clearfix">
    			<?php if ( is_user_logged_in() ) : ?>
    			<p class="edit-post">
    				<?php edit_post_link( sprintf( __( 'Edit %s', 'graphene' ), $post_type->labels->singular_name ), ' (', ')' ); ?>
    			</p>
    			<?php endif; ?>
                
                <?php /* Microdata field for "Updated" */ ?>
                <?php if ( ! graphene_should_show_date() ) : ?>
                <span class="updated"><span class="value-title" title="<?php the_time( 'Y-m-d\TH:i' ); ?>" /></span>
                <?php endif; ?>
    			
    			<?php /* Inline post date */ ?>
    			<?php if ( graphene_post_date_setting( get_the_ID() ) == 'text' ) graphene_post_date(); ?>
    			
    			<?php /* Post author, not shown if admin decides to hide it */ ?>
    			<?php if ( $graphene_settings['hide_post_author'] != true ) : ?>
    			<p class="post-author author vcard">
    				<?php
    				/* translators: this is for the author byline, such as 'by John Doe' */
    				$author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url">' . get_the_author_meta( 'display_name' ) . '</a>';
    				printf( __( 'by %s', 'graphene' ), '<span class="fn nickname">' . apply_filters( 'graphene_author_url', $author_url ) . '</span>' );
    				?>
    			</p>
    			<?php endif; ?>
    								
    			<?php /* For printing: the date of the post */
    			if ( $graphene_settings['print_css'] && graphene_should_show_date() ) {
    				 echo graphene_print_only_text( '<em>' . get_the_time( get_option( 'date_format' ) ) . '</em>' );  
    			}
    			?>
    			
    			<?php do_action( 'graphene_post_meta' ); ?>
    		</div>
    		
    		<?php /* Post content */ ?>
    		<div class="entry-content clearfix">
    			<?php do_action( 'graphene_before_post_content' ); ?>
    				
    			<?php /* Social sharing buttons at top of post */ ?>
    			<?php if ( stripos( $graphene_settings['addthis_location'], 'top' ) !== false ) { graphene_addthis( get_the_ID() ); } ?>
    				
    			<?php /* The full content */ ?>
    			<?php the_content(); ?>
    			
    			<?php wp_link_pages( array( 'before' => '<div class="link-pages"><p><strong>' . __( 'Pages:','graphene' ) . '</strong> ', 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
    			
    			<?php do_action( 'graphene_after_post_content' ); ?>
    			
    		</div>
    		
    		<?php /* Post footer */ ?>
    		<div class="entry-footer clearfix">
    			<?php /* Display the post's tags, if there is any */ ?>
    			<?php if ( $graphene_settings['hide_post_tags'] != true ) : ?>
    				<p class="post-tags"><?php if ( has_tag() ) { _e( 'Tags:','graphene' ); the_tags( ' ', ', ', '' ); } else { _e( 'This post has no tag','graphene' ); } ?></p>
    			<?php endif; ?>
    			
    			<?php 
    			/* Display AddThis social sharing button */
    			if ( stripos( $graphene_settings['addthis_location'], 'bottom' ) !== false) { graphene_addthis( get_the_ID() ); } 
    			?>
    			
    			<?php do_action( 'graphene_post_footer' ); ?>
    		</div>
    	</div>
    </div>
    
    <?php 
    /**
     * Display the post author's bio in single-post page if enabled
    */
    if ( $graphene_settings['show_post_author'] ) :
    ?>
    <h4 class="author_h4 vcard"><?php _e( 'About the author', 'graphene' ); ?></h4>
    <div class="author-info clearfix">
    	<div <?php graphene_grid( 'author-avatar-wrap', 2, 2, 2, true ); ?>>
    	<?php
    	if ( $author_imgurl = get_the_author_meta( 'graphene_author_imgurl' ) ) {
    		echo '<img class="avatar" src="' . $author_imgurl . '" alt="" />';
    	} else {
    		echo get_avatar( get_the_author_meta( 'user_email' ), graphene_grid_width( '', 2 ) ); 
    	}
    	?>
        </div>
    	<p class="author_name"><strong><?php the_author_meta( 'display_name' ); ?></strong></p>
    	<div class="author_bio"><?php echo wpautop( get_the_author_meta( 'description' ) ); ?></div>
    	
    </div>
    <?php endif; ?>
    
    <?php /* For printing: the permalink */
    	if ( $graphene_settings['print_css'] ) {
    		echo graphene_print_only_text( '<span class="printonly url"><strong>' . __( 'Permanent link to this article:', 'graphene' ) . ' </strong><span>' . get_permalink() . '</span></span>' );
    	}
    ?>
    
    <?php 
    /**
     * Display Adsense advertising for single post pages 
     * See graphene_adsense() function in functions.php
    */ 
    graphene_adsense(); ?>
    
    <?php /* Get the comments template for single post pages */ ?>
    <?php comments_template(); ?>
    
    <?php do_action( 'graphene_loop_footer' ); ?>

    This is line 18 :

    if ( in_array( $post_format, $supported_formats ) ) {

    Thread Starter frankorev

    (@frankorev)

    Hi thanks for your reply.
    This is the error message just only when I active php8 :

    Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /home/primed/ccc/wp-content/themes/cmca/loop-film.php:18 Stack trace: #0 /home/primed/ccc/wp-content/themes/cmca/loop-film.php(18): in_array(false, false) #1 /home/primed/ccc/wp-includes/template.php(772): require('/home/primed/cc...') #2 /home/primed/ccc/wp-includes/template.php(716): load_template('/home/primed/cc...', false, Array) #3 /home/primed/ccc/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #4 /home/primed/ccc/wp-content/themes/cmca/single-film.php(33): get_template_part('loop', 'film') #5 /home/primed/ccc/wp-includes/template-loader.php(106): include('/home/primed/cc...') #6 /home/primed/ccc/wp-blog-header.php(19): require_once('/home/primed/cc...') #7 /home/primed/ccc/index.php(17): require('/home/primed/cc...') #8 {main} thrown in /home/primed/ccc/wp-content/themes/cmca/loop-film.php on line 18

    I hope that you can help me.

    Thread Starter frankorev

    (@frankorev)

    Ok thanks but I’ve already done this using CPT UI (add/edit taxionomies).
    Of course CPT UI lets you to create custom taxionomy for your content post type.
    My problem is that I’d like to show the links to custom categories of my CPT under the title of the CPT. And not for the others posts (the classic posts made by wordpress).
    To do this I need to modify my loop_single.php with the function `<?php
    // Get the ID of a given category
    $category_id = get_cat_ID( ‘Category Name’ );

    // Get the URL of this category
    $category_link = get_category_link( $category_id );
    ?>`
    But nothing happens….
    This is my problem and this is the entirely code of loop_singles.php

    <?php
    	global $graphene_settings;
    	$post_type = get_post_type_object( get_post_type() );
    ?>
    <?php
    /**
     * Check if the post has a post format. Load a post-format specific loop file,
     * if it has. Continue with standard loop otherwise.
    */
    if ( function_exists( 'get_post_format' ) ) {
    	global $post_format;
    	$post_format = get_post_format();
    
    	// Get the post formats supported by the theme
    	$supported_formats = get_theme_support( 'post-formats' );
    	if ( is_array( $supported_formats ) ) $supported_formats = $supported_formats[0]; 
    
    	if ( in_array( $post_format, $supported_formats ) ) {
    
    		// Get the post format loop file
    		get_template_part( 'loop-post-formats', $post_format );
    
    		// Stop this default posts loop
    		return;
    	}
    }
    ?>
    <?php /* Post navigation */ ?>
    <?php graphene_post_nav(); ?>
    
    <div id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix post' ); ?>>
    
    	<?php do_action( 'graphene_before_post' ); ?>
    
    	<div class="entry clearfix">
    
            <?php /* Post date */ ?>
            <?php if ( stristr( graphene_post_date_setting( get_the_ID() ), 'icon' ) ) graphene_post_date(); ?>
    
            <?php /* Show the post author's gravatar if enabled */
    		if ( $graphene_settings['show_post_avatar'] ) {
    			echo '<div class="post-avatar-wrap gutter-left">' . get_avatar( get_the_author_meta( 'user_email' ), 45 ) . '</div>';
    		}
    		?>
    
            <?php
    		/* Add a print button only for single pages/posts
    		 * and if the theme option is enabled.
    		 */
    		if ( $graphene_settings['print_button'] ) : ?>
    			<?php graphene_print_button( $post_type ); ?>
    		<?php endif; ?>
    
            <?php /* Add an email post icon if the WP-Email plugin is installed and activated */
    			if( function_exists( 'wp_email' ) ) { echo '<p class="email wp-email-button">'; email_link(); echo '</p>'; }
    		?>
    
    		<?php /* Post title */ ?>
            <h1 class="post-title entry-title">
    			<?php if ( get_the_title() == '' ) { _e( '(No title)', 'graphene' ); } else { the_title(); } ?>
    			<?php do_action( 'graphene_post_title' ); ?>
            </h1>
    
    		<?php /* Post meta */ ?>
    		<div class="post-meta clearfix">
    
    			<?php /* Post category, not shown if admin decides to hide it */ ?>
    			<?php if ( ( $graphene_settings['hide_post_cat'] != true ) ) : ?>
    			<span class="printonly"><?php _e( 'Categories:', 'graphene' ); ?> </span>
    			<p class="meta_categories"><?php the_category( ", " ); ?></p>
    			<?php endif; ?>
    
    			<?php /* Edit post link, if user is logged in */ ?>
    			<?php if ( is_user_logged_in() ) : ?>
    			<p class="edit-post">
    				<?php edit_post_link( sprintf( __( 'Edit %s', 'graphene' ), $post_type->labels->singular_name ), ' (', ')' ); ?>
    			</p>
    			<?php endif; ?>
    
                <?php /* Microdata field for "Updated" */ ?>
                <?php if ( ! graphene_should_show_date() ) : ?>
                <span class="updated"><span class="value-title" title="<?php the_time( 'Y-m-d\TH:i' ); ?>" /></span>
                <?php endif; ?>
    
    			<?php /* Inline post date */ ?>
    			<?php if ( graphene_post_date_setting( get_the_ID() ) == 'text' ) graphene_post_date(); ?>
    
    			<?php /* Post author, not shown if admin decides to hide it */ ?>
    			<?php if ( $graphene_settings['hide_post_author'] != true ) : ?>
    			<p class="post-author author vcard">
    				<?php
    				/* translators: this is for the author byline, such as 'by John Doe' */
    				$author_url = '<a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" class="url">' . get_the_author_meta( 'display_name' ) . '</a>';
    				printf( __( 'by %s', 'graphene' ), '<span class="fn nickname">' . apply_filters( 'graphene_author_url', $author_url ) . '</span>' );
    				?>
    			</p>
    			<?php endif; ?>
    
    			<?php /* For printing: the date of the post */
    			if ( $graphene_settings['print_css'] && graphene_should_show_date() ) {
    				 echo graphene_print_only_text( '<em>' . get_the_time( get_option( 'date_format' ) ) . '</em>' );
    			}
    			?>
    
    			<?php do_action( 'graphene_post_meta' ); ?>
    		</div>
    
    		<?php /* Post content */ ?>
    		<div class="entry-content clearfix">
    			<?php do_action( 'graphene_before_post_content' ); ?>
    
    			<?php /* Social sharing buttons at top of post */ ?>
    			<?php if ( stripos( $graphene_settings['addthis_location'], 'top' ) !== false ) { graphene_addthis( get_the_ID() ); } ?>
    
    			<?php /* The full content */ ?>
    			<?php the_content(); ?>
    
    			<?php wp_link_pages( array( 'before' => '<div class="link-pages"><p><strong>' . __( 'Pages:','graphene' ) . '</strong> ', 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
    
    			<?php do_action( 'graphene_after_post_content' ); ?>
    
    		</div>
    
    		<?php /* Post footer */ ?>
    		<div class="entry-footer clearfix">
    			<?php /* Display the post's tags, if there is any */ ?>
    			<?php if ( $graphene_settings['hide_post_tags'] != true ) : ?>
    				<p class="post-tags"><?php if ( has_tag() ) { _e( 'Tags:','graphene' ); the_tags( ' ', ', ', '' ); } else { _e( 'This post has no tag','graphene' ); } ?></p>
    			<?php endif; ?>
    
    			<?php
    			/* Display AddThis social sharing button */
    			if ( stripos( $graphene_settings['addthis_location'], 'bottom' ) !== false) { graphene_addthis( get_the_ID() ); }
    			?>
    
    			<?php do_action( 'graphene_post_footer' ); ?>
    		</div>
    	</div>
    </div>
    
    <?php
    /**
     * Display the post author's bio in single-post page if enabled
    */
    if ( $graphene_settings['show_post_author'] ) :
    ?>
    <h4 class="author_h4 vcard"><?php _e( 'About the author', 'graphene' ); ?></h4>
    <div class="author-info clearfix">
    	<div <?php graphene_grid( 'author-avatar-wrap', 2, 2, 2, true ); ?>>
    	<?php
    	if ( $author_imgurl = get_the_author_meta( 'graphene_author_imgurl' ) ) {
    		echo '<img class="avatar" src="' . $author_imgurl . '" alt="" />';
    	} else {
    		echo get_avatar( get_the_author_meta( 'user_email' ), graphene_grid_width( '', 2 ) );
    	}
    	?>
        </div>
    	<p class="author_name"><strong><?php the_author_meta( 'display_name' ); ?></strong></p>
    	<div class="author_bio"><?php echo wpautop( get_the_author_meta( 'description' ) ); ?></div>
    
    </div>
    <?php endif; ?>
    
    <?php /* For printing: the permalink */
    	if ( $graphene_settings['print_css'] ) {
    		echo graphene_print_only_text( '<span class="printonly url"><strong>' . __( 'Permanent link to this article:', 'graphene' ) . ' </strong><span>' . get_permalink() . '</span></span>' );
    	}
    ?>
    
    <?php
    /**
     * Display Adsense advertising for single post pages
     * See graphene_adsense() function in functions.php
    */
    graphene_adsense(); ?>
    
    <?php /* Get the comments template for single post pages */ ?>
    <?php comments_template(); ?>
    
    <?php do_action( 'graphene_loop_footer' ); ?>

    *
    Any ideas ?

    Thread Starter frankorev

    (@frankorev)

    a) I have custom categoiry terms assigned to custom post type
    b) This is my loop, the problem is that I don’t want to show categories in normal post but only in content post types created with CPTUI : (theme Graphene 1.9.4.1, wp 4.3.1)

    <?php /* Post meta */ ?>
    		<?php if ( $post_type->name != 'page' || is_user_logged_in() ) : ?>
    		<div class="post-meta clearfix">
    
    			<?php /* Post category, not shown if admin decides to hide it */ ?>
    			<?php if ( ( $graphene_settings['hide_post_cat'] != true ) ) : ?>
    			<span class="printonly"><?php _e( 'Categories:', 'graphene' ); ?> </span>
    			<p class="meta_categories"><?php the_category( ", " ); ?></p>
    			<?php endif; ?>

    c) It’s custom categories created by CPT UI so these aren’t classic WP taxionomy
    How can do?

    Thread Starter frankorev

    (@frankorev)

    Michael thanks for your reply.
    My problem that I’d like to show a link of post’s categories under the title of the post. This only for the content posts type that I made using CPT UI.
    I tryed with
    <?php the_category(‘ ‘); ?>
    modifying loop-single.php on graphene theme
    but nothnig appends…

    Some ideas?

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