WordPress.org

Ready to get started?Download WordPress

Forums

Flexible Posts Widget
[resolved] Is excerpt possible? (10 posts)

  1. Mistu
    Member
    Posted 1 year ago #

    Hi! First of all, congratulations for that nice and usefull plugin for wordpress! I've been looking for a nice widget to show my posts on a sidebar, and that one is the best so far :) I really like the "skip X", option that no other has!

    I just need one extra detail to make it perfectly fit my needs, I need the option to show the excerpt or the first "XX" characters of the post that will be displayed in the widget.

    I don't know if that's so hard to implement, most of other plugins I've seen that let me put any post on a widged have that option. Could I touch anything on the php files to make it possible? Would you include that option on a future update? I really need it!

    Thankyou very much! :)

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

  2. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mistu,

    The plugin already allows you to define your own display templates. Much like WordPress's own templates, you can adjust what gets displayed for each widget. You can use any standard WordPress loop/post functions, including the_excerpt within those custom templates.

    The instructions for creating your own FPW template(s) are here: http://wordpress.org/extend/plugins/flexible-posts-widget/installation/.

    Hope that helps!

  3. Mistu
    Member
    Posted 1 year ago #

    Hi Dave, thanks for your quick answer.

    I haven't enought php programming skills to make it myself :(

    I already created my own template for that plugin, as described in readme. I adapted it to my needs (different font, size, align, not listing objects, etc). But don't know how to add the excerpt. I tried to but doesn't works well :|

    If there's not so much code to wrote for make that happen, could you suggest me in a few lines that code to have the excerpt be displayed? I really feel that could be a nice improvement for your plugin, if you add it as a feature (show / don't show excerpt).

    Thanks for your time!

  4. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    Sure, in your custom template at the location you'd like to show the excerpt just insert this PHP: <?php the_exerpt(); ?>. It works the same was as the PHP <?php the_title(); ?> within the default FPW template.

    Of course for these PHP functions to work you need to be in the FPW WordPress loop (http://codex.wordpress.org/The_Loop). That means it needs to be added somewhere between the following two lines in your template.

    After this line:
    <?php while ( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); ?>

    And before this line:
    <?php endwhile; ?>

    Cheers!

  5. Mistu
    Member
    Posted 1 year ago #

    THANKS! very usefull :) I noted the little mistake on <?php the_exerpt(); ?>, a "C" was missing there :)

  6. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    Ah yes, good catch. :)

  7. Mistu
    Member
    Posted 1 year ago #

    Hi DavE!

    That change worked on your plugin but also affected other template and plugin options that also use excerpt ... It fixes excerpt lenght for all of them, and that's not good :(

    Is there any option to have a "custom" exceprt length only for your plugin? And ... about flexible posts, what about adding the option to show the excerpt or the first "XX" characters of the post that will be displayed in the widget?

    As I said, near all other plugins I've seen that let me put any post on a widged have that option. Is there any possibility to include that option?

    Thank you very much :)

  8. Mistu
    Member
    Posted 1 year ago #

    In my template there's also a custom option to show the first "XX" characters of the excerpt. But now with my custom modification, his maximum length is fixed and cannot be overpassed :(

  9. Mistu
    Member
    Posted 1 year ago #

    Sorry, I made a mistake on my explanation :)

    The fact is that I needed to change the length of the excerpt, 'cause your solution gived me a SO MUCH LONG excerpt (999, which is the maximum). So I needed to add that code:

    function custom_excerpt_length( $length ) {
    return 55; }

    But now all excerpts are "trunked" at 55 :| This is why I am asking for the option on that plugin :P

    Sorry for the mistake and hope u can help me!

  10. DaveE
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mistu,

    The plugin is meant to allow for advanced templating configurations using the custom template options, including adjusting the excerpt length on your own. If you'd like to set a different excerpt length for the widget and not for your regular posts, you'll probably want to investigate using some simple PHP functions to do so.

    Adding a custom excerpt length setting to the plugin doesn't really make sense because the custom templates may or may not use an excerpt at all. That's really the benefit of allowing custom templates - users can modify the widget output however they would like.

    Sorry I'm not more help to you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.