WordPress.org

Ready to get started?Download WordPress

Forums

Flexible Posts Widget
[resolved] Shortcode (10 posts)

  1. PeterRinderer
    Member
    Posted 2 years ago #

    I like your new plugin very much. It is possible to add the shortcode-feature. I want tu use it not only as a widget, but within a post! Thanks a lot, Peter

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

  2. DaveE
    Member
    Plugin Author

    Posted 2 years ago #

    Hi Peter,

    Sorry for my slow response. Yes, that seems plausible. I'll add it to the wish list. Thanks for using the plugin!

  3. Ricardo
    Member
    Posted 2 years ago #

    I'd love to see this feature too.
    Is there a function to call in order to include the content of the widget in a template? Thanks!

  4. Ricardo
    Member
    Posted 2 years ago #

    I realized the plugin shows private posts, even if you're not logged in your blog. They should be hidden.

  5. DaveE
    Member
    Plugin Author

    Posted 2 years ago #

    Good catch, Richard. I've updated the plugin to not include Private posts.

  6. Ricardo
    Member
    Posted 2 years ago #

    Great! Thank you!

  7. DaveE
    Member
    Plugin Author

    Posted 2 years ago #

    Peter & Richard,

    I spent some time thinking through adding shortcode support over the weekend (as well as publishing a new version of the plugin) and am not sure if it really makes sense to add that to the existing plugin as the plugin is very widget-specific. It almost seems like a completely separate plugin (functionality-wise).

    But, I haven't forgotten about the request. I'll let you know how things proceed.

  8. Ricardo
    Member
    Posted 2 years ago #

    Hi Dave!
    It's your choice and it will be welcome as you decide to do it. :)
    Thank you!

  9. capson
    Member
    Posted 1 year ago #

    Hello, here is a work-a-round for shortcodes. To do this you will need a custom_functions.php file:

    1.) Create a widgitized sidebar that is called with a shortcode

    Place in your custom_functions.php file:

    //Registering the sidebar1
    function ilc_register_sidebars1(){
        register_sidebar(array(
            'name' => 'Sidecode1',
            'description' => 'Widgets in this area will be shown using [shortbar1]',
            'before_widget' => '<div id="%1$s" class="%2$s">',
            'after_widget' => '</div>',
    	'before_title' => '<h3>',
    	'after_title' => '</h3>'
        ));
    }
    add_action( 'init', 'ilc_register_sidebars1');
    add_shortcode( 'shortbar1', 'shortbar_sc1' );
    
    //Creating the shortcode output
    function shortbar_sc1( $atts ) {
        ob_start();
        dynamic_sidebar('sidecode1');
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }

    Then, add to a page or post with [shortbar1] now
    go to widget page and add post widget to the sidecode1 sidebar.

    You will probably need a plugin like widget logic or Widget Logic Visual or display widgets so you can use the [shortbar1] more then once.

    If you need more then one sidebar change all the 1's to 2's
    except do NOT change these <div id="%1$s" class="%2$s">

    I hope this is helpful.

  10. capson
    Member
    Posted 1 year ago #

    Also, I just found this plugin that does the same thing, I have not used it but here is the link:
    http://wordpress.org/extend/plugins/widgets-on-pages/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic