• Resolved LCT

    (@lct)


    Hello,

    I love this plugin! I would like to put a link on each article of my website to the year of publication. For example: if the post is dated 01/15/2015, the link must lead to all the other articles posted in 2015. Is there any php code for this that I could add to my pages? Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    Hello. Glad you like the plugin.
    What you are requesting is not really related to our plugin, but more a theme issue.

    After taking a quick look, it seems the meta info is being generated from the theme’s wellington_entry_meta() function:

    if ( ! function_exists( 'wellington_entry_meta' ) ) :
    	/**
    	 * Displays the date, author and categories of a post
    	 */
    	function wellington_entry_meta() {
    		$postmeta = wellington_meta_date();
    		$postmeta .= wellington_meta_author();
    		echo '<div class="entry-meta">' . $postmeta . '</div>';
    	}
    endif;
    

    So you can either redefine this function to create the entry-meta as you like, or redefine just the wellington_meta_date() function:

    if ( ! function_exists( 'wellington_meta_date' ) ) :
    	/**
    	 * Displays the post date
    	 */
    	function wellington_meta_date() {
    		$time_string = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date published updated" datetime="%3$s">%4$s</time></a>',
    			esc_url( get_permalink() ),
    			esc_attr( get_the_time() ),
    			esc_attr( get_the_date( 'c' ) ),
    			esc_html( get_the_date() )
    		);
    		return '<span class="meta-date">' . $time_string . '</span>';
    	}
    endif;
    

    In the above function, you would simply need to replace:

    esc_url( get_permalink( ) ),
    

    with:

    esc_url( get_year_link( get_the_date( 'Y' ) ) ),
    

    But as stated, this is beyond the scope of our plugin. You might want to reach out to the theme developers’ support forum for proper guidance on this.

    All the best!

    Thread Starter LCT

    (@lct)

    Thank you very much for your reply. I will try that!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a year link to each post’ is closed to new replies.