Co Authors Plus plugin in Parabola

  • Author
    Posts
  • #43576

    There has been a similar topic regarding this plugin here, but this was for the Verbosa theme, which seems to have a different buildup compared to Parabola. (At least different enough for me to not be able to figure out from the example how to implement it in this theme.) I have made a Parabola child theme wherein I made a copy of the theme-loop.php to add the plugin code to show the extra authors at the front-end as well. I used the technique similar to the one the plugin author recommends here.

    The way I wrote it doesn’t seem to work, but that’s most likely because I only got taught the basics of PHP. The excerpt of code down below is what I tried last and didn’t work. Can someone help me out?

    if ( ! function_exists( 'parabola_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post—date/time and author.
     *
     * @since parabola 0.5
     */
    function parabola_posted_on() {
         global $parabolas;
         foreach ($parabolas as $key => $value) { ${"$key"} = $value; }
    
         // If author is hidden don't give it a value
    	if ( function_exists( 'coauthors_posts_links' ) ) {
    		$author_string = coauthors_posts_links( null, null, null, null, false )
    		};
    	else {
        $author_string = sprintf( '<span class="author vcard" >'.__( 'By ','parabola'). ' <a class="url fn n" rel="author" href="%1$s" title="%2$s">%3$s</a></span>',
        			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
        			sprintf( esc_attr__( 'View all posts by %s', 'parabola' ), get_the_author() ),
        			get_the_author()
        		);
    		};
    
         // Post date/time option
         $date_string='<span><time class="onDate date published" datetime="' . get_the_time( 'c' ) . '"> %3$s </time></span>' .
                        '<time class="updated"  datetime="' . get_the_modified_date( 'c' ) . '">' . get_the_modified_date() . '</time>';
         switch($parabola_postdatetime){
              case "date":
                   $parabola_formatted_datetime = sprintf( '<a href="%1$s" rel="bookmark">%2$s</a>', esc_url( get_permalink() ), get_the_date() ); break;
              case "time":
                   $parabola_formatted_datetime = sprintf( '<a href="%1$s" rel="bookmark"> %2$s</a>', esc_url( get_permalink() ), esc_attr( get_the_time() ) ); break;
              case "hide":
                   $parabola_formatted_datetime = "";$date_string = ""; break;
              case "datetime":
              default:
                   $parabola_formatted_datetime = sprintf( '<a href="%1$s" rel="bookmark">%3$s - %2$s</a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), get_the_date() );
         } // switch
    
         // Print the meta data
    	printf( '&nbsp; %4$s '.$date_string.' <span class="bl_categ"> %2$s </span>  ',
            'meta-prep meta-prep-author',
            get_the_category_list( ', ' ),
            $parabola_formatted_datetime,
            $author_string
    	);
    }; // parabola_posted_on()
    endif;
Viewing 1 post (of 1 total)

The topic ‘Co Authors Plus plugin in Parabola’ is closed to new replies.