• Resolved poojim

    (@poojim)


    Hello everyone!

    New here in forums. I was actually looking for a way to change a “text widget” content through custom fields in the post editor. Or are there any plugins that can help me.

    I want to have a changing content for sidebar per post wherein I can change the sidebar content through post editor. The best thing I thought that can help me is through a “changing dynamic text widget” that can be edited for every post. Moreover, text widget can read html codes and other codes.

    I also thought of adding more dynamic sidebars but that won’t be practical if I like different contents per post. That means I would have to create many dynamic sidebars.

    If you have any ideas please help me thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this widget: http://wordpress.org/extend/plugins/php-code-widget/

    What is it you want to do exactly? Show some content you put in a Custom Field?

    Something like this I guess (where NAME is the name of the custom field):

    <?php
    if (is_single() && get_post_meta($post->ID, 'NAME', true)) {
    echo get_post_meta($post->ID, 'NAME', true);
    }
    ?>
    Thread Starter poojim

    (@poojim)

    okay. Thanks for the replies,,,

    To be specific I want a custom sidebar content that changes per post. I knew we can create different sidebars per post but that won’t be practical.

    I’ll try your suggested plug in keesiemeijer because it can call php plus the code given by chadrew.

    “What is it you want to do exactly? Show some content you put in a Custom Field?” – Yes! and show them in the sidebar….

    Sidebars are not ‘in the loop‘…you can create a table in your post or page with content that shows on the right or left, and use a theme that turns off the main sidebars on post or pages…

    You can also use templates

    Thread Starter poojim

    (@poojim)

    chadrew, it isn’t working… (whether the code or the plugin

    swanson, I find it boring to read all those but I got the thoughts that it’s probably not on the loop since there is no <?php get_sidebar(); ?> on my single.php

    My intention was to help…Just call me turtle.

    Thread Starter poojim

    (@poojim)

    okay thanks turtle….

    So how do I do this? Am not very good with php:

    “Sidebars are not ‘in the loop’…you can create a table in your post or page with content that shows on the right or left, and use a theme that turns off the main sidebars on post or pages…”

    Just put the code I gave you in your sidebar.php file (somewhere under all the widgets, I guess). And don’t forget to replace NAME with the actual name of the custom field. I just tried it and it worked for me.

    Thread Starter poojim

    (@poojim)

    what the… yeas it worked! At first I tried calling it in a widget. I didn’t tried it on sidebar.php cause I didn’t got the logic… Now I’m ashamed. lol. Thanks chadrew!!!….

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Change Text Widget Content Through Custom Fields’ is closed to new replies.