Missing/not reachable link in columns text

  • Author
    Posts
  • #38785

    Hello,

    I use the columns feature to show random blog posts with an background image, the title, a separator and the beginning text of the post. The problem is that the text area is not linked to the post, only the title and the image (which is totally in the background) are linked. Unfortunately the title is also not reachable, so there exists no link to the post and this feature seems to be useless.

    I tried to save an excerpt with a space so only the title is shown in the columns. That would be okay and works, but of course on the site with all posts there is no excerpt text then. So that’s no solution.

    Is there a possibility to override the function generating the column content in my existing Nirvana child theme so that the text will not be shown and only the linked title shows up in front of the background image?

    Thanks,
    Steffen (http://www.radtrekkingblog.de)

    Example screenshot

    #38786

    I fixed it on my own (without any knowledge in PHP, haha): With help of Google and the child theme tutorial given here I managed to find, analyze and override the function nirvana_singlecolumn_output($data) in widgets.php in my child project (functions.php). I added/changed

    
    <?php echo '<a href="'.$link.'" '.$blank.'>'; ?>
    <?php the_excerpt_max_charlength(do_shortcode($text), 90); ?>
    <?php echo '</a>'; ?>
    

    and a function which shortens the excerpt text of each random post (with a different char amount from that Nirvana uses).

    
    function the_excerpt_max_charlength($text, $charlength) {
    	$excerpt = $text;
    	$charlength++;
    
    	if ( mb_strlen( $excerpt ) > $charlength ) {
    		$subex = mb_substr( $excerpt, 0, $charlength - 5 );
    		$exwords = explode( ' ', $subex );
    		$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
    		if ( $excut < 0 ) {
    			echo mb_substr( $subex, 0, $excut );
    		} else {
    			echo $subex;
    		}
    		echo '...';
    	} else {
    		echo $excerpt;
    	}
    }
    

    Problem solved

    • This reply was modified 8 years ago by Steffen.
    #38939
    Zed
    Cryout Creations mastermind

    We’ll try to add filters for harcoded values so they’re easier to customize in the future.


    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Missing/not reachable link in columns text’ is closed to new replies.