Forums

Posts with individual widgets? (8 posts)

  1. myrko
    Member
    Posted 3 years ago #

    Hi, I'm looking for a way to have an individual widget for the sidebar for diffferent posts.

    For instance a post about football should have a video widget about a game and a poll widget about football.
    Others posts i.e. about tennis should have different widgets and so on.

    In the end, say the first two widgets in the sidebar should be post-dependend.

    Now, one could do this with the widget-logic plugin, selecting the post, but then you get a huge sidebar if you want to satisfy 100+ different posts that way.

    The best way would be a plugin that would add a (or more) individual widgets per ever post, able to be edited from the post screen.

    Is there anything like this?

  2. alanft
    Member
    Posted 3 years ago #

    i suggested to someone else that they 'roll their own' widget using html put into a custom field in a post. then use say

    http://wordpress.org/extend/plugins/php-code-widget/

    to produce a widget that does

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

    then the widget would contain the HTML that you put in the 'post_widget_1_content' custom field on that post

  3. myrko
    Member
    Posted 3 years ago #

    alanft, thank you. That's a very nice idea.

    However, I couldn't get any output. Tried it on two blogs (WP 2.7) just to be sure. It seems that the field ist not recognized or the content of it is not found. Have you tried it lately?

  4. alanft
    Member
    Posted 3 years ago #

    you have put something in a custom field of that name, right?

    perhaps the php needs the $post variable imported via
    global $post
    first?

    i troubleshoot PHP variables with lines like
    echo "<pre>"; print_r($post); echo "</pre>"
    which shows you a nice representation of the variables in question. (in this case $post is usually a very large array.)

  5. myrko
    Member
    Posted 3 years ago #

    alanft, thanks. This is true, "global $post" is needed.

    But it is alsway on ID 1 regardless of the post I am showing. Any further idea?

  6. myrko
    Member
    Posted 3 years ago #

    Btw. there was a plugin that seemed to be doing this: Widget Changer: http://maketecheasier.com/wordpress-plugins/wordpress-widget-changer

    Unfortunately it is not compatible with WP 2.7 and the author is not developing it any further.

    is ther something similar somewhere?

  7. myrko
    Member
    Posted 3 years ago #

    Alright, as a final note: The Advanced Custom Field Plugin is the way to go: http://wordpress.org/extend/plugins/advanced-custom-field-widget/

    It is very good and solves this problem completely :)

  8. linda van wissen
    Member
    Posted 2 years ago #

    Hi I have troubles placing individual posts into individual posts on my two sidebars? Could some one please help?
    http://www.lindaenjoysfood.com thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags