Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cascadingstyles

    (@cascadingstyles)

    Hi Joy, thank you so much for your advice. I have checked the urls and both are 404s so I guess the plugin was removed. I shall look for an alternative solution.

    Thread Starter cascadingstyles

    (@cascadingstyles)

    Hi @bcworkz Thanks for your reply. While searching for the correct meta key, I found this post. I was able to fix the problem using this code:

    case 'author':
    	$meta_html[ $meta ] = '<span class="author' . $preview . '">' . get_the_author_posts_link() . '</span>';
    	break;

    Thanks again for your support!

    Thread Starter cascadingstyles

    (@cascadingstyles)

    Hi again @bcworkz I tried your advice and it worked, the author name is now hyperlinked. However it links to the home page. Any idea how I can get it to link to the author profile?

    Here is a sample post and the profile I would like it linked to (I am using profile ID as the url).

    Thank you in advance.

    Thread Starter cascadingstyles

    (@cascadingstyles)

    Hi @bcworkz Thank you so much for your reply. It looks like the function is indeed pluggable, in which case, does that mean I can just copy paste it into functions.php of my child theme? I will try this in any case.

    Here is the whole function:

    if ( ! function_exists( 'basic_get_postmeta' ) ):
    	function basic_get_postmeta() {
    
    		$default_meta_list = get_theme_mod( 'postmeta_list', 
    						   apply_filters( 'basic_postmeta_list_defaults', array( 'date', 'category', 'comments' ) )
    						  );
    		$default_meta_list = ! is_array( $default_meta_list ) ? explode( '_', $default_meta_list ) : $default_meta_list;
    
    		$meta_list           = apply_filters( 'basic_post_meta_list', $default_meta_list );
    		$displayed_meta_list = $meta_list;
    
    		if ( is_customize_preview() ) {
    			$all       = array_merge( $meta_list, array( 'date', 'category', 'comments', 'tags', 'author' ) );
    			$meta_list = array_unique( $all );
    		}
    
    		if ( empty( $meta_list ) ) {
    			return;
    		}
    
    		$meta_html = array();
    
    		foreach ( $meta_list as $meta ) {
    			$preview = ( ! in_array( $meta, $displayed_meta_list ) ) ? ' hide' : '';
    			switch ( $meta ) {
    				case 'date':
    					$meta_html[ $meta ] = '<span class="date' . $preview . '">' . get_the_time( get_option( 'date_format' ) ) . '</span>';
    					break;
    				case 'author':
    					$meta_html[ $meta ] = '<span class="author' . $preview . '"><a href="' . get_the_author_meta('url', $author_id) . '">' . get_the_author() . '</a></span>';
    					break;
    				case 'category':
    					$meta_html[ $meta ] = '<span class="category' . $preview . '">' . get_the_category_list( ', ' ) . '</span>';
    					break;
    				case 'comments':
    					$meta_html[ $meta ] = '<span class="comments' . $preview . '"><a href="' . get_comments_link() . '">' . __( 'Comments', 'basic' ) . ': ' . get_comments_number() . '</a></span>';
    					break;
    				case 'tags':
    					$meta_html[ $meta ] = '<span class="tags' . $preview . '">' . get_the_tag_list( __( 'Tags: ', 'basic' ), ', ' ) . '</span>';
    					break;
    			}
    		}
    		$meta_html = apply_filters( 'basic_post_meta_list_html', $meta_html );
    
    		$html = '';
    		foreach ( $meta_list as $meta ) {
    			$html .= ( array_key_exists($meta,$meta_html) ) ? $meta_html[ $meta ] : '';
    		}
    
    		$html = apply_filters( 'basic_post_meta_html', $html );
    
    		echo '<aside class="meta">';
    		do_action( 'basic_post_meta_before_first' );
    
    		echo $html;
    
    		do_action( 'basic_post_meta_after_last' );
    		echo '</aside>';
    	}
    endif;
    add_action( 'basic_after_post_title', 'basic_get_postmeta', 10 );

    Thanks again.

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