WordPress.org

Ready to get started?Download WordPress

Forums

Know a "One widget per post" plugin? (7 posts)

  1. kjetilgf
    Member
    Posted 4 years ago #

    I'm looking for a plugin that can give me one widget for every post.
    Eg. I like to show a map with a brief text in the sidebar - different for each post.
    Is there such a plugin?
    Thanks,
    Kjetil
    PS Widget changer did the job, but regretably isn't developed beyond WP26x

  2. alanft
    Member
    Posted 4 years ago #

    You could 'roll your own' using a standard PHP code widget and

    echo get_post_meta($post->ID, 'per_post_widget_content', true);

    for example, to display the text in the post's 'per_post_widget_content' custom field.

  3. kjetilgf
    Member
    Posted 4 years ago #

    Thanks a lot, Alan!
    I guess I can find out how to do the php part (just making your line part of an expression and insert it in my sidebar.php - right?)
    - But which "standard php code widget" would you suggest? Daiko's text widget + Widget logic? Or something even easier?
    Thanks a lot - I really appreciate this help.
    Kjetil
    - Dolcevita.no

  4. alanft
    Member
    Posted 4 years ago #

  5. kjetilgf
    Member
    Posted 4 years ago #

    Thanks - this might be a solution
    BUT, since I have a site with (for now) about 200 posts, each of them with one unique widget, I would get a huge stack of widgets.

    Widget changer gives an extra html/writing field under the post's write field + one widget. Whatever you insert in that field appears eg at the top of your sidebar (if that is where you've placed the widget).
    For instance here the map is inserted in that extra field. Another post has another map - though both of them are placed there using one widget in the widget panel.

    Other ideas?
    Thanks a lot for trying
    Kjetil

  6. alanft
    Member
    Posted 4 years ago #

    my suggestion is just one widget too. one PHP code widget that displays a post's 'per_post_widget_content' custom field. you specify the text to appear in a custom field for each post.

  7. kjetilgf
    Member
    Posted 4 years ago #

    OK - I think I get the point! :o)
    If you could just help me with the exact code I should insert in that widget, it would be of GREAT help!
    (I don't know much php, but I believe the code you gave initially is missing something (?) - like a start with <?php... - right? Or is it just
    <?php echo get_post_meta($post->ID, 'per_post_widget_content', true); ?>)
    Thanks a lot
    Kjetil

Topic Closed

This topic has been closed to new replies.

About this Topic