• Trying to use the functions from the template-tags.php file and dont get any output. Is this the right way to use?? Any help would be greatly appreciated.

    I’ve tried other functions like the get_the_coauthor_meta or the_coauthor_meta and nothing seems to happen except the ‘array’ output. What am I missing?

    
     <?php if ( function_exists( 'coauthors_links_single' ) ) 
         { coauthors_links_single(); } 
            else { 
               the_author_posts_link(); 
     } ?>
    
    
    • This topic was modified 8 years, 3 months ago by lance1572.
Viewing 1 replies (of 1 total)
  • Thread Starter lance1572

    (@lance1572)

    Ok. I totally went about this the wrong way. If anyone has similar issues. Instead directly putting them in my template. I put it in my functions file.

    
        if ( ! function_exists( 'jemma_ev_posted_on' ) ) :
    /**
     * Prints HTML with meta information for the current post-date/time and author.
     */
    function jemma_ev_posted_on() {
    
        if ( function_exists( 'coauthors_posts_links' ) ) :
            printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'jemma_ev' ),
                'meta-prep meta-prep-author',
                sprintf( '<span class="entry-date">%3$s</span>',
                    get_permalink(),
                    esc_attr( get_the_time() ),
                    get_the_date()
                ),
                coauthors_posts_links( null, null, null, null, false )
            );
        else:
            printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'jemma_ev' ),
                'meta-prep meta-prep-author',
                sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
                    get_permalink(),
                    esc_attr( get_the_time() ),
                    get_the_date()
                ),
                sprintf( '<span class="article-author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
                    get_author_posts_url( get_the_author_meta( 'ID' ) ),
                    esc_attr( sprintf( __( 'View all posts by %s', 'jemma_ev' ), get_the_author() ) ),
                    get_the_author()
                )
            );
        endif;
    }
    
    endif;
    
    

    and within my content.php file I just called the function where I needed it, like so

    
        jemma_ev_posted_on();
    
    
Viewing 1 replies (of 1 total)
  • The topic ‘Using the functions within template’ is closed to new replies.