Force the Genesis Featured Posts widget to show the 'Read More' link?

Community Forums Forums Design Tips and Tricks Force the Genesis Featured Posts widget to show the 'Read More' link?

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  braddalton 2 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #83398

    mattspaeth
    Participant
    Post count: 11

    Have a layout where I am not showing content, but need the ‘Read More’ link. So basically, I am showing the post title only, and then want to have a button below the title for ‘Read More’.

    I know how to take care of all the styling, but not sure how to force the widget to display the ‘Read More’ link if no content is being displayed.

    How can I achieve this?

    • This topic was modified 9 months, 3 weeks ago by  mattspaeth. Reason: typo
    • This topic was modified 9 months, 3 weeks ago by  mattspaeth. Reason: typo
    #83839

    mattspaeth
    Participant
    Post count: 11

    Found this great post on creating tweaking the Genesis Featured Posts widget by Peter Coughlin:

    http://petercoughlin.com/tweaking-the-genesis-featured-posts-widget/

    Using that, I created a duplicate of featured-posts-widget.php in the theme folder, unregistered the old one and registered the new one.

    Now I am trying to tweak the code to display the ‘Read More’ link when no content is being displayed, but having difficulty getting it to work.

    This is the section that I believe needs to be modified:

    		if ( ! empty( $instance['show_content'] ) ) {
    
    				echo genesis_html5() ? '<div class="entry-content">' : '';
    
    				if ( 'excerpt' == $instance['show_content'] ) { // Show Content 
    					the_excerpt();
    				}
    				elseif ( 'content-limit' == $instance['show_content'] ) { // Show Content Limit
    					the_content_limit( (int) $instance['content_limit'], esc_html( $instance['more_text'] ) );
    				}
    				else { 
    
    					printf ('Show Excerpt');
    
    					global $more;
    
    					$orig_more = $more;
    					$more = 0;
    
    					the_content( esc_html( $instance['more_text'] ) );
    
    					$more = $orig_more;
    
    				}
    
    				echo genesis_html5() ? '</div>' : '';
    
    			}

    I haven’t been able to get any of my modifications to show up. I even commented out this entire section to see if it would break the plugin but it didn’t. I was wondering if my theme was actually loading this version of the widget instead of the old one. So then I commented out the entire function that encloses this section, which did break the plugin so I know I have all that taken care of.

    This PHP is over my head. I am working through the tutorials at http://www.developphp.com/, but if anyone can offer some advice to help me get this project done, I would really appreciate it!

    Thanks,
    Matt

    #116731

    braddalton
    Participant
    Post count: 10263
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.