WordPress.org

Forums

Recent Posts FlexSlider
[resolved] Adding post author and comments in the slider (11 posts)

  1. sstk
    Member
    Posted 1 year ago #

    Hello,

    I want to add the post author name and the post comments just below the post title in the slider, so is it possible ? I have added it anyway but it is not working properly, it is just showing the latest post's author name and comments. So if there is any way please let me know.

    Thanks.

    http://wordpress.org/plugins/recent-posts-flexslider/

  2. David Laietta
    Member
    Plugin Author

    Posted 1 year ago #

    Hello,

    Unfortunately that's not a feature that I've built into the plugin. It is possible to edit the template files to include this, using some functions built into WordPress such as get_the_author_meta()

    http://codex.wordpress.org/Function_Reference/get_the_author_meta

    Thanks,
    David

  3. sstk
    Member
    Posted 1 year ago #

    Hello David,

    Thank you for your answer. I know that your plugin don't have those features. But I want to enable those by editing your files. I tried by adding some code in the diplay.php file but the code is not working properly. I want to add this feature of author "<?php the_author_posts_link(); ?>" along with Comments for per slider post. So how can I do these please ? I will wait for your help.

    Thank you

  4. David Laietta
    Member
    Plugin Author

    Posted 1 year ago #

    I would place that within the display.php file which is in the views folder of the plugin.

    Between lines 32 and 60 (the if/while statements) is where the individual slides are made. Since the title is here (line 45-47):

    if($post_title == 'true'):
    $output .= '<h3>' . get_the_title() . '</h3>';
    endif;

    I would place your code below that.

    Thanks,
    David

  5. sstk
    Member
    Posted 1 year ago #

    Hello,

    I have placed the code as you said like the following way:

    if($post_title == 'true'): $output .= '<h3>' . get_the_title() . '</h3>'; endif; the_author_posts_link(); comments_popup_link('0 Comments', '1 Comment', '% Comments');

    But there is none of the author name and comment showing. So can you please check for once and let me know what I did wrong ? Here is the site Link.

    Thanks

  6. sstk
    Member
    Posted 1 year ago #

    I have also tried in this way:

    if($post_title == 'true'): $output .= '<h3>' . get_the_title() . '</h3>'; endif;
    $output .= '<p>' . the_author_posts_link() . '</p>'; $output .= '<p>' . comments_popup_link('0 Comments', '1 Comment', '% Comments') . '</p>';

  7. David Laietta
    Member
    Plugin Author

    Posted 1 year ago #

    What I'm seeing on your site is the list item that is a slide, followed by the author and comment links. The HTML for one slide right now looks like this:
    <li style="text-align: center; width: 645px; float: left; display: block;" class="clone" aria-hidden="true">

    <div style="height: px" id="TWP18">
    <img width="541" height="764" src="http://css.fotocomefare.com/wp-content/uploads/corso-lightroom-5.png" class="full wp-post-image" alt="Signore e signori, ecco a voi il corso su Lightroom di FotoComeFare.com" title="Signore e signori, ecco a voi il corso su Lightroom di FotoComeFare.com" draggable="false">
    </div>
    <div class="flexslider-caption" id="TWP19"><div class="flexslider-caption-inner" id="TWP20"><h3>Signore e signori, ecco a voi il corso su Lightroom di FotoComeFare.com</h3><p id="TWP187"></p><p id="TWP188"></p></div></div>

    2 commenti

    You need to move the author and comment links at the end into the div that is called <div class="flexslider-caption-inner">, that way it will show up in the slide. You're still going to need to change some styles to make it look right for your site, but this is a start.

  8. sstk
    Member
    Posted 1 year ago #

    Are you please speaking about like the following way ? I have used like that way now but still I don't see those. Can you please check for again? Thanks.

    `// Display Post Title and/or Excerpt (option set on Appearance->Widgets)
    if($post_title == 'true' || $post_excerpt == 'true'):
    $output .= '<div class="flexslider-caption"><div class="flexslider-caption-inner">';
    if($post_title == 'true'):
    $output .= '<h3>' . get_the_title() . '</h3>';
    endif;
    if($post_excerpt == 'true'):
    $output .= '<p>' . $display->recent_post_flexslider_excerpt(get_the_content(), $excerpt_length) . '</p>';
    endif;
    $output .= '<p>' . the_author_posts_link() . '</p>';
    $output .= '<p>' . comments_popup_link('0 Comments', '1 Comment', '% Comments') . '</p>';
    $output .= '</div></div>';
    endif;

  9. David Laietta
    Member
    Plugin Author

    Posted 1 year ago #

    I would consider using a function that returns the author and comments, as opposed to echoing them. Try out get_author_posts_url(). I don't know of a simple method to return the comments instead of echoing them in the format that comments_popup_link does.

    http://codex.wordpress.org/Function_Reference/get_author_posts_url

  10. vikramadityas60
    Member
    Posted 1 year ago #

    how can i show all comments on index pages rather then different pages in slide.

  11. David Laietta
    Member
    Plugin Author

    Posted 1 year ago #

    I don't know what you mean specifically, and it's probably outside of the scope of the slider plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Recent Posts FlexSlider
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags