WordPress.org

Ready to get started?Download WordPress

Forums

Flexible Recent Posts
[resolved] All posts linked directly from the widget title (6 posts)

  1. QuickeneR
    Member
    Posted 1 year ago #

    Needed the link to all posts to be in the widget title. Did not find a clear way. Had to do some patches. Hope to see them included in the next version of the Flexible Recent Posts plugin. Thanks.

    --- class-recent-posts-widget.php.org	2012-07-25 13:58:24.000000000 +0600
    +++ class-recent-posts-widget.php	2012-07-25 14:00:57.000000000 +0600
    @@ -30,6 +30,7 @@
     			array(
     				'title'                     => '',
     				'number'                    => 2,
    +				'all_posts_link_in_title'   => false,
     				'all_posts_link_title'      => false,
     				'all_posts_link_footer'     => true,
     				'all_posts_title'           => __( 'All news', 'frp' ) . ' >>',
    @@ -98,6 +99,7 @@
     		$instance['template'] = $new_instance['template'];
     		$instance['categories'] = $_POST['post_category'];
     		$instance['all_categories'] = isset( $new_instance['all_categories'] ) ? true : false;
    +		$instance['all_posts_link_in_title'] = isset( $new_instance['all_posts_link_in_title'] ) ? true : false;
     		$instance['all_posts_link_title'] = isset( $new_instance['all_posts_link_title'] ) ? true : false;
     		$instance['all_posts_link_footer'] = isset( $new_instance['all_posts_link_footer'] ) ? true : false;
     		$instance['all_posts_title'] = strip_tags( $new_instance['all_posts_title'] );
    
    --- recent-posts-form.php.org	2012-07-12 19:03:13.000000000 +0600
    +++ recent-posts-form.php	2012-07-25 14:04:31.000000000 +0600
    @@ -28,11 +28,19 @@
     		   value="<?php print $instance['all_posts_link']; ?>" type="text">
     </p>
     <p>
    +	<input type="checkbox" <?php print checked( $instance['all_posts_link_in_title'], true, false ); ?>
    +		   name="<?php print $this->get_field_name( 'all_posts_link_in_title' ); ?>"
    +		   id="<?php print $this->get_field_id( 'all_posts_link_in_title' ); ?>">&nbsp;
    +	<label
    +		for="<?php print $this->get_field_id( 'all_posts_link_in_title' ); ?>"><?php print __( 'Link the widget title itself', 'frp' ); ?></label><br/>
    +
     	<input type="checkbox" <?php print checked( $instance['all_posts_link_title'], true, false ); ?>
     		   name="<?php print $this->get_field_name( 'all_posts_link_title' ); ?>"
     		   id="<?php print $this->get_field_id( 'all_posts_link_title' ); ?>">&nbsp;
     	<label
     		for="<?php print $this->get_field_id( 'all_posts_link_title' ); ?>"><?php print __( 'Show near the widget title', 'frp' ); ?></label><br/>
    +
    +
     	<input type="checkbox" <?php print checked( $instance['all_posts_link_footer'], true, false ); ?>
     		   name="<?php print $this->get_field_name( 'all_posts_link_footer' ); ?>"
     		   id="<?php print $this->get_field_id( 'all_posts_link_footer' ); ?>">&nbsp;
    
    --- recent-posts-widget.php.org	2012-07-12 19:03:13.000000000 +0600
    +++ recent-posts-widget.php	2012-07-25 13:56:54.000000000 +0600
    @@ -2,7 +2,15 @@
     echo $before_widget;
    
     if ( !empty( $instance['title'] ) ) {
    -	echo $before_title . $instance['title'] . $after_title;
    +	echo $before_title;
    +	if ( $instance['all_posts_link_in_title'] ):
    +	  echo "<a href=" . $category_link . ">";
    +	endif;
    +	echo $instance['title'];
    +	if ( $instance['all_posts_link_in_title'] ):
    +	  echo "</a>";
    +	endif;
    +	echo $after_title;
    
     	if ( $instance['all_posts_link_title'] ):
     		?>

    http://wordpress.org/extend/plugins/flexible-recent-posts/

  2. Paul Annekov
    Member
    Plugin Author

    Posted 1 year ago #

    It's not good practise to use widget title as link to anything.

    As workaround you can just add space " " symbol to widget "Title" option and check option to show all posts link near the widget title.

  3. QuickeneR
    Member
    Posted 1 year ago #

    Why do you think this is a bad practice? It is the most reasonable place for an all posts link. I tried using >>> as link title and placing it after the title but it looked not nearly as neat.

  4. Paul Annekov
    Member
    Plugin Author

    Posted 1 year ago #

    1. Just go here and you will see, that top blogs don't use such feature.
    2. Titles and links are two different entities. You have not mix them.

  5. QuickeneR
    Member
    Posted 1 year ago #

    Went to the first blog from the link, the Huffington post, and what did I see? 'Featured', 'Blog posts', 'Most popular on Huffpost' (in the sidebar), and even 'Social news' are all hyperlinks. This is exactly what I want to do with FRP.

    Your argument on titles vs. links escapes me completely. Why would you want to limit yourself to only one of these if you could mix them at will as appropriate? OK, I suppose if we were talking of a book in HTML, there would be no purpose of turning a chapter title into a link... hmm... actually, it could link back to the table of contents. Come to think of it, *everything* needs a potential to become a link, if you can find a good target for it. That's how the entire Wikipedia works, btw.

  6. Paul Annekov
    Member
    Plugin Author

    Posted 1 year ago #

    Why I don't want to add such functionality?

    1. I don't like, when widget title mixed with link. Why WordPress's standart widgets doesn't have such capability (Recent posts, Categories, Archives)? It's not so obviously for user, that widget title may be a link. But if you will add underscore to title text - it will be obviously, but look bad.
    2. User must not be confused, when looking on widget options. So less options - clear for user.

    Please, add this request here. I will think one more time about it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.