Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good day @mooningfish

    Regarding the related posts and social media buttons, chances are those plugins providing that information aren’t set to display on the custom post type posts, so you’ll need to check there.

    For the meta regarding the post, it’s hard for me to say what’s going on there, but you or someone else will need to check the active theme files to see what’s going on for that section. Very likely a single.php file as a starting point.

    Thread Starter mooningfish

    (@mooningfish)

    Thank you for replying.

    I imagine that all of these are the same problem since nothing other than the main content is displaying. I have looked at the single.php file, and the content.php files. I can’t really figure out what to look for.

    Can you offer any other advice? I’m working with the Twenty Fifteen theme, if that helps.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The TwentyFifteen detail does actually help.

    The social media/related is still going to be a settings thing for them, so you’ll need o contact their plugin devs for better support there.

    For the metadata, if you look at content.php, you’ll see this line towards the end of the file:

    <?php twentyfifteen_entry_meta(); ?>
    

    That’s where the meta data is coming from. The function is defined in inc/template-tags.php If you’re using a child theme, you can define your own version of the same function, and that will allow customizing as necessary. Technically, you can also just edit the parent version, but that would make it harder to update later.

    The full function just for ease of viewing:

    if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
    /**
     * Prints HTML with meta information for the categories, tags.
     *
     * @since Twenty Fifteen 1.0
     */
    function twentyfifteen_entry_meta() {
    	if ( is_sticky() && is_home() && ! is_paged() ) {
    		printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) );
    	}
    
    	$format = get_post_format();
    	if ( current_theme_supports( 'post-formats', $format ) ) {
    		printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',
    			sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ),
    			esc_url( get_post_format_link( $format ) ),
    			get_post_format_string( $format )
    		);
    	}
    
    	if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
    		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    
    		if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    			$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    		}
    
    		$time_string = sprintf( $time_string,
    			esc_attr( get_the_date( 'c' ) ),
    			get_the_date(),
    			esc_attr( get_the_modified_date( 'c' ) ),
    			get_the_modified_date()
    		);
    
    		printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
    			_x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ),
    			esc_url( get_permalink() ),
    			$time_string
    		);
    	}
    
    	if ( 'post' == get_post_type() ) {
    		if ( is_singular() || is_multi_author() ) {
    			printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
    				_x( 'Author', 'Used before post author name.', 'twentyfifteen' ),
    				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    				get_the_author()
    			);
    		}
    
    		$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
    		if ( $categories_list && twentyfifteen_categorized_blog() ) {
    			printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    				_x( 'Categories', 'Used before category names.', 'twentyfifteen' ),
    				$categories_list
    			);
    		}
    
    		$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
    		if ( $tags_list ) {
    			printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
    				_x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),
    				$tags_list
    			);
    		}
    	}
    
    	if ( is_attachment() && wp_attachment_is_image() ) {
    		// Retrieve attachment metadata.
    		$metadata = wp_get_attachment_metadata();
    
    		printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
    			_x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ),
    			esc_url( wp_get_attachment_url() ),
    			$metadata['width'],
    			$metadata['height']
    		);
    	}
    
    	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
    		echo '<span class="comments-link">';
    		/* translators: %s: post title */
    		comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) );
    		echo '</span>';
    	}
    }
    endif;
    

    You’ll see a number of spots where it’s checking for the post type, and defaulting to mostly just post, so you’ll need to make it check for your post type slug as well.

    Thread Starter mooningfish

    (@mooningfish)

    thank you Michael. This fixed the metadata problem.

    I’m reaching out to the other plugin developers for help with that detail.

    cheers!

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

The topic ‘custom post type looks different than regular post’ is closed to new replies.